#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
外部任务接口模型模块
包含外部任务创建相关的请求和响应数据模型
"""

from typing import Optional, List, Dict, Any
from enum import Enum
from pydantic import BaseModel, Field

# 任务类型枚举
class TaskTypeEnum(str, Enum):
    """任务类型枚举"""
    GG2MP = "GG2MP"      # 高柜到MP
    GGFK2MP = "GGFK2MP"  # 高柜发库到MP
    GT2MP = "GT2MP"      # 高台到MP
    GTFK2MP = "GTFK2MP"  # 高台发库到MP
    ZG2MP = "ZG2MP"      # 中柜到MP
    QZ2MP = "QZ2MP"      # 清洗到MP
    LG2MP = "LG2MP"      # 料柜到MP
    PHZ2MP = "PHZ2MP"    # 配货站到MP
    MP2GG = "MP2GG"      # MP到高柜
    MP2GGFK = "MP2GGFK"  # MP到高柜发库
    MP2GT = "MP2GT"      # MP到高台
    MP2GTFK = "MP2GTFK"  # MP到高台发库
    MP2ZG = "MP2ZG"      # MP到中柜
    MP2QZ = "MP2QZ"      # MP到清洗
    MP2LG = "MP2LG"      # MP到料柜
    MP2PHZ = "MP2PHZ"    # MP到配货站

# 外部任务创建请求模型
class ExternalTaskRequest(BaseModel):
    """外部任务创建请求模型"""
    ReqCode: str = Field(..., description="请求唯一标识码")
    SourceID: str = Field("", description="来源ID")
    TargetID: str = Field(..., description="目标ID")
    TaskType: TaskTypeEnum = Field(..., description="任务类型")

# 外部任务创建响应模型
class ExternalTaskResponse(BaseModel):
    """外部任务创建响应模型"""
    code: int = Field(..., description="响应码，0表示成功")
    reqCode: str = Field(..., description="请求唯一标识码")
    message: str = Field(..., description="响应消息")
    rowCount: int = Field(0, description="影响行数")

# 位置路径项模型
class PositionCodePath1(BaseModel):
    """位置路径项模型"""
    PositionCode: str = Field(..., description="位置代码")
    Type: str = Field(..., description="类型")

# AGV调度任务请求模型
class GenAgvSchedulingTaskRequest(BaseModel):
    """AGV调度任务请求模型"""
    ReqCode: str = Field("", description="请求唯一标识码")
    TaskTyp: str = Field("", description="任务类型")
    SecurityKey: str = Field("", description="安全密钥")
    Type: str = Field("", description="类型")
    TaskCode: str = Field("", description="任务代码")
    SubType: str = Field("", description="子类型")
    AreaPositonCode: str = Field("", description="区域位置代码")
    AreaPositonName: str = Field("", description="区域位置名称")
    PositionCodePath: List[PositionCodePath1] = Field(..., description="位置代码路径")
    ClientCode: str = Field("", description="客户端代码")
    TokenCode: str = Field("", description="令牌代码")

# 取消任务请求模型
class CancelTaskRequest(BaseModel):
    """取消任务请求模型"""
    ReqCode: str = Field(..., description="请求唯一标识码")