# _*_ coding : UTF-8 _*_
# @Time : {{ current_time }}
# @UpdateTime : {{ current_time }}
# @Author : {{ author }}
# @File : {{ table_name }}.py
# @Comment : 本程序用于生成{{ table_comment }}参数和响应模型

from datetime import datetime
from typing import Optional, List
from pydantic import BaseModel, Field, ConfigDict
from pydantic.alias_generators import to_snake
from schemas.common import BaseResponse, ListQueryResult

class {{ class_name }}Info(BaseModel):
    """{{ description }}信息"""
    model_config = ConfigDict(alias_generator=to_snake, populate_by_name=True)
    {% for column in columns if column.is_list %}
    {{ column.python_name }}: {% if not column.is_required %}Optional[{% endif %}{{ column.python_type }}{% if not column.is_required %}]{% endif %} = Field(
        {% if column.default is not none %}default={{ column.default }}, {% endif %}title="{{ column.column_comment }}"
    )
    {% endfor %}

class Add{{ class_name }}Params(BaseModel):
    """新增{{ description }}参数"""
    model_config = ConfigDict(alias_generator=to_snake, populate_by_name=True)
    {% for column in columns if column.is_insert %}
    {{ column.python_name }}: {% if not column.is_required %}Optional[{% endif %}{{ column.python_type }}{% if not column.is_required %}]{% endif %} = Field(
        {% if column.default is not none %}default={{ column.default }}, {% endif %}title="{{ column.column_comment }}"
    )
    {% endfor %}

class Update{{ class_name }}Params(BaseModel):
    """更新{{ description }}参数"""
    model_config = ConfigDict(alias_generator=to_snake, populate_by_name=True)
    {% for column in columns if column.is_edit %}
    {{ column.python_name }}: {% if not column.is_required %}Optional[{% endif %}{{ column.python_type }}{% if not column.is_required %}]{% endif %} = Field(
        {% if column.default is not none %}default={{ column.default }}, {% endif %}title="{{ column.column_comment }}"
    )
    {% endfor %}

class Get{{ class_name }}InfoResponse(BaseResponse):
    """获取{{ description }}信息响应"""
    data: {{ class_name }}Info = Field(None, title="{{ table_comment }}信息")

class Get{{ class_name }}InfoListResult(ListQueryResult):
    """获取{{ description }}信息列表响应结果"""
    result: List[{{ class_name }}Info] = Field(None, title="{{ table_comment }}信息列表")

class Get{{ class_name }}ListResponse(BaseResponse):
    """获取{{ description }}信息列表响应"""
    data: Get{{ class_name }}InfoListResult = Field(None, title="{{ table_comment }}信息列表")
