# _*_ coding : UTF-8 _*_
# @Time : 2025/02/12 17:03
# @UpdateTime : 2025/02/12 17:03
# @Author : sonder
# @File : config.py
# @Software : PyCharm
# @Comment : 本程序
from datetime import datetime
from typing import Optional, List

from pydantic import BaseModel, Field, ConfigDict
from pydantic.alias_generators import to_camel

from schemas.common import BaseResponse, ListQueryResult


class ConfigInfo(BaseModel):
    """
    配置信息模型
    """
    model_config = ConfigDict(alias_generator=to_camel)
    id: str = Field(..., description="主键")
    create_by: str = Field(default="", description="创建者")
    create_time: Optional[datetime] = Field(default=None, description="创建时间")
    update_by: str = Field(default="", description="更新者")
    update_time: Optional[datetime] = Field(default=None, description="更新时间")
    name: str = Field(default="", description="配置名称")
    key: str = Field(default="", description="配置键名")
    value: str = Field(default="", description="配置值")
    type: bool = Field(default=False, description="系统内置")
    remark: str = Field(default="", description="备注")


class AddConfigParams(BaseModel):
    """
    添加配置参数模型
    """
    name: str = Field(..., max_length=100, description="配置名称")
    key: str = Field(..., max_length=100, description="配置键名")
    value: str = Field(..., max_length=100, description="配置值")
    type: bool = Field(default=False, description="系统内置")
    remark: Optional[str] = Field(default=None, max_length=255, description="备注信息")


class DeleteConfigListParams(BaseModel):
    """
    批量删除配置参数模型
    """
    ids: List[str] = Field(default=[], description="配置ID")


class GetConfigInfoResponse(BaseResponse):
    """
    获取配置模型信息响应
    """
    data: ConfigInfo = Field(default=None, description="响应数据")


class GetConfigInfoResult(ListQueryResult):
    """
    获取配置模型信息结果
    """
    result: List[ConfigInfo] = Field(default=[], description="列表数据")


class GetConfigListResponse(BaseResponse):
    """
    获取配置列表响应
    """
    data: GetConfigInfoResult = Field(default=None, description="响应数据")
