from typing import Any

from pydantic import BaseModel, Field


class PromptTemplateVO(BaseModel):
    id: int = Field(..., description='模板ID')
    template_name: str = Field(..., description='模板名称')
    template_code: str | None = Field(None, description='模板code')
    template_type: str = Field(..., description='模板类型')
    description: str | None = Field(None, description='模板描述')
    template_content: str = Field(..., description='模板内容')
    template_abbreviation: str | None = Field(None, description='模板简称')
    variables: dict[str, Any] = Field(default_factory=dict, description='变量定义')
    status: int = Field(0, description='状态')
    version: str = Field('v1.0', description='版本')
    created_by: int | None = Field(None, description='创建人ID')
    created_by_username: str | None = Field(None, description='创建人用户名')
    created_at: str = Field('', description='创建时间')
    updated_at: str = Field('', description='更新时间')


class PromptTemplateListVO(BaseModel):
    total: int = Field(0, description='总数')
    page: int = Field(1, description='页码')
    page_size: int = Field(20, description='分页大小')
    items: list[PromptTemplateVO] = Field(default_factory=list, description='模板列表')


class PromptTemplateTypeOptionVO(BaseModel):
    value: str = Field(..., description='类型值')
    label: str = Field(..., description='类型名称')
    count: int = Field(0, description='数量')


class PromptTemplateTypeListVO(BaseModel):
    items: list[PromptTemplateTypeOptionVO] = Field(default_factory=list, description='模板类型列表')
