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

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

from schemas.common import BaseResponse, ListQueryResult


class LocaleInfo(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="更新时间")
    code: str = Field(default="", description="语言代码")
    name: str = Field(default="", description="语言名称")


class AddLocaleParams(BaseModel):
    """
    添加语言类型参数
    """
    code: str = Field(default="", description="语言代码")
    name: str = Field(default="", description="语言名称")


class GetLocaleInfoResponse(BaseResponse):
    """
    获取语言模型信息响应
    """
    data: LocaleInfo = Field(default=None, description="语言模型信息")


class GetLocaleInfoResult(ListQueryResult):
    """
    获取语言模型信息结果
    """
    result: List[LocaleInfo] = Field(default=[], description="语言模型信息")


class GetLocaleListResponse(BaseResponse):
    """
    获取语言模型信息响应
    """
    data: GetLocaleInfoResult = Field(default={}, description="语言模型信息")


class I18nInfo(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="更新时间")
    key: str = Field(default="", description="国际化key")
    locale_code: str = Field(default="", description="语言代码")
    locale_id: str = Field(default="", description="语言ID")
    locale_name: str = Field(default="", description="语言名称")
    translation: str = Field(default="", description="翻译内容")


class AddI18nParams(BaseModel):
    """
    添加国际化参数
    """
    key: str = Field(default="", description="国际化key")
    locale_id: str = Field(default="", description="语言ID")
    translation: str = Field(default="", description="翻译内容")


class GetI18nInfoResponse(BaseResponse):
    """
    获取国际化模型信息响应
    """
    data: I18nInfo = Field(default=None, description="国际化模型信息")


class GetI18nInfoResult(ListQueryResult):
    """
    获取国际化模型信息结果
    """
    result: List[I18nInfo] = Field(default=[], description="国际化模型信息")


class GetI18nListResponse(BaseResponse):
    """
    获取国际化模型信息响应
    """
    data: GetI18nInfoResult = Field(default=None, description="国际化模型信息")


class I18nList(BaseModel):
    """
    国际化模型信息
    """
    model_config = ConfigDict(alias_generator=to_camel)
    locale: str = Field(default="", description="语言名称")
    name: str = Field(default="", description="语言名称")
    data: dict = Field(default={}, description="国际化模型信息")


class GetI18nInfoListResponse(BaseResponse):
    """
    获取国际化模型信息响应
    """
    data: I18nList = Field(default=None, description="国际化模型信息")
