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




class Sys_alertModel(BaseModel):
    """
    系统告警表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='主键 自增')
    detail: Optional[str] = Field(default=None, description='告警描述')
    type: 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='更新者')






class Sys_alertQueryModel(Sys_alertModel):
    """
    系统告警不分页查询模型
    """
    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 Sys_alertPageQueryModel(Sys_alertQueryModel):
    """
    系统告警分页查询模型
    """

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


class DeleteSys_alertModel(BaseModel):
    """
    删除系统告警模型
    """

    model_config = ConfigDict(alias_generator=to_camel)

    ids: str = Field(description='需要删除的主键 自增')
