from middleware import *
import datetime


class HlmForwardRequest(BaseModel):
    method: str = Field(default="GET", description="请求方法")
    headers: dict = Field(default={}, description="请求头")
    target_url: str = Field(default="", description="目标地址")
    query_params: str = Field(default="", description="请求参数")


class ModelGetDeviceConfig(BaseModel):
    """获取可执行程序命令列表"""

    tab_id: int = Field(
        default=1, description="类型，【执行左脚程序】或者【执行右脚程序】"
    )


class ModelGetDeviceConfigDetail(BaseModel):
    """获取可执行程序命令列表"""

    id: int = Field(default=None, description="可执行程序得id")


class ModelGetDeviceConfigDetailQuery(BaseModel):
    """获取可执行程序命令列表"""

    tab_id: int = Field(default=1, index=True, max_length=128)
    action_name: Optional[str] = Field(default="", index=True, max_length=128)


class SaveDeviceConfig(BaseModel):
    """获取可执行程序命令列表"""

    id: Optional[int] = Field(default=None, primary_key=True)
    tab_id: Optional[int] = Field(default=0, index=True)
    action_name: Optional[str] = Field(default="", index=True, max_length=128)
    action_index: Optional[int] = Field(default=None)
    action_status: Optional[bool] = Field(default=None)
    is_system: Optional[bool] = Field(default=False)
    camera_height: Optional[int] = Field(default=None)
    camera_angle: Optional[float] = Field(default=None)
    number_focus: Optional[int] = Field(default=None)
    take_picture: Optional[bool] = Field(default=None)
    turntable_position: Optional[float] = Field(default=None)
    turntable_angle: Optional[float] = Field(default=None)
    shoe_upturn: Optional[bool] = Field(default=None)
    pre_delay: Optional[float] = Field(default=None)
    after_delay: Optional[float] = Field(default=None)
    led_switch: Optional[bool] = Field(default=None)
    is_wait: Optional[bool] = Field(default=False)
    is_need_confirm: Optional[bool] = Field(default=False)


class PhotoRecordDelete(BaseModel):
    """获取可执行程序命令列表"""

    goods_art_nos: list[str] = Field(default=None, description="货号数组")


class SysConfigParams(BaseModel):
    """系统配置"""

    key: str = Field(default=None, description="类型")
    value: str = Field(default=None, description="json数据")


class LeftRightParams(BaseModel):
    """系统配置"""

    id: int = Field(default=0, description="配置id")
    type: str = Field(default="left", description="类型，left左；right:右边")


class TemplateItem(BaseModel):
    """模板项"""

    template_id: str = Field(description="模板名称")
    template_local_classes: str = Field(description="模板名称")


class MaineImageTest(BaseModel):
    """模板项"""

    file_path: str = Field(description="图片地址")


class HandlerDetail(BaseModel):
    """获取可执行程序命令列表"""

    goods_art_no: list[str] = Field(default=None, description="货号")
    uuid: str = Field(default=None, description="uuid")
    token: str = Field(default="", description="惠利玛请求token")
    template_image_order: str = Field(default="", description="模板图片排序")
    excel_path: Optional[str] = Field(default="", description="excel路径")
    temp_name: str = Field(default="", description="选中的模板名称")
    temp_list: list[TemplateItem] = Field(default=[], description="所有模板列表")
    logo_path: Optional[str] = Field(default="", description="logo地址路径")
    is_only_cutout: Optional[int] = Field(default=0, description="是否仅抠图;0否;1是")
    online_stores: Optional[list[str]] = Field(
        default=[], description="上传的店铺，数组形式"
    )
    is_product_scene: Optional[int] = Field(
        default=0, description="是否生成场景图;0否;1是"
    )
    is_detail: Optional[int] = Field(default=0, description="是否生成详情图;0否;1是")
    is_upper_footer: Optional[int] = Field(
        default=0, description="是否生成上脚图;0否;1是"
    )
    product_scene_prompt: Optional[str] = Field(
        default=[], description="上传的店铺，数组形式"
    )
    upper_footer_params: Optional[dict] = Field(
        default=None, description="上脚图参数配置"
    )


class LogoParams(BaseModel):
    """logo参数"""

    logo_path: str = Field(default="", description="logo地址路径")


class LogoParamsupdate(BaseModel):
    """系统配置"""

    path: str = Field(default=None, description="要删除得文件路径")


class DeviceConfigTabsReq(BaseModel):
    id: int = Field(default=None, primary_key=True)
    mode_name: str = Field(default="", description="Tab名称")


class RecordUpdate(BaseModel):
    """系统配置"""

    id: int = Field(default=0, description="记录id")
    image_path: str = Field(default=None, description="图片地址")


class SyncLocalConfigs(BaseModel):
    """同步系统配置"""

    token: str = Field(default=None, description="用户token")
    
