from datetime import datetime

from pydantic import BaseModel


class AIModelConfigCreate(BaseModel):
    model_config = {"protected_namespaces": ()}
    name: str
    model_id: str
    task: str  # extraction, tts, stt, teach, keyword, flashcard
    api_key: str | None = None
    is_active: bool = True
    is_default: bool = False


class AIModelConfigResponse(BaseModel):
    model_config = {"protected_namespaces": (), "from_attributes": True}
    id: int
    name: str
    model_id: str
    task: str
    is_active: bool
    is_default: bool
    created_at: datetime


class AIModelConfigUpdate(BaseModel):
    model_config = {"protected_namespaces": ()}
    name: str | None = None
    model_id: str | None = None
    task: str | None = None
    api_key: str | None = None
    is_active: bool | None = None
    is_default: bool | None = None
