from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import NotBlank
from typing import Optional
from module_admin.annotation.pydantic_annotation import as_query


class SwitchExplanationStyleModel(BaseModel):

    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    pairing_id: int = Field(default=None, description='主键ID')
    robot_id: int = Field(default=None, description='机器人ID（关联robot_info表）')
    robot_role_id: int = Field(default=None, description='机器人角色ID（关联robot_role表）')

    update_by: Optional[str] = Field(default=None, description='修改者')





class Explanation_style_robot_pairModel(BaseModel):
    """
    讲解风格--机器人配对表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    pairing_id: Optional[int] = Field(default=None, description='主键ID')
    robot_id: Optional[int] = Field(default=None, description='机器人ID（关联robot_info表）')
    robot_role_id : Optional[int] = Field(default=None, description='机器人角色ID（关联robot_role表）')
    explanation_style_id: Optional[int] = Field(default=None, description='讲解风格ID（关联explanation_style表）')
    prompt: Optional[str] = Field(default=None, description='提示词')
    status: Optional[str] = Field(default=None, description='状态(0停用,1使用)')
    create_time: Optional[datetime] = Field(default=None, description='创建时间')
    create_by: Optional[str] = Field(default=None, description='创建者')
    update_time: Optional[datetime] = Field(default=None, description='修改时间')
    update_by: Optional[str] = Field(default=None, description='修改者')

    @NotBlank(field_name='robot_id', message='机器人ID不能为空')
    def get_robot_id(self):
        return self.robot_id

    @NotBlank(field_name='explanation_style_id', message='讲解风格ID不能为空')
    def get_explanation_style_id(self):
        return self.explanation_style_id


    def validate_fields(self):
        self.get_robot_id()
        self.get_explanation_style_id()




class Explanation_style_robot_pairQueryModel(Explanation_style_robot_pairModel):
    """
    讲解风格--机器人配对不分页查询模型
    """
    begin_create_time: Optional[str] = Field(default=None, description='开始创建时间')
    end_create_time: Optional[str] = Field(default=None, description='结束创建时间')
    begin_update_time: Optional[str] = Field(default=None, description='开始修改时间')
    end_update_time: Optional[str] = Field(default=None, description='结束修改时间')


@as_query
class Explanation_style_robot_pairPageQueryModel(Explanation_style_robot_pairQueryModel):
    """
    讲解风格--机器人配对分页查询模型
    """

    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


class DeleteExplanation_style_robot_pairModel(BaseModel):
    """
    删除讲解风格--机器人配对模型
    """

    model_config = ConfigDict(alias_generator=to_camel)

    pairing_ids: str = Field(description='需要删除的主键ID')
