from typing import List, Optional
from pydantic import BaseModel

""" 获取任务结果响应结构 """


class ImageInfo(BaseModel):
    origin: str
    image: str


class MaskInfo(BaseModel):
    name: str
    score: float
    coords: List[List[int]]


class ResultItem(BaseModel):
    id: str
    images: ImageInfo
    masks: List[MaskInfo]


class AnalyzeResultData(BaseModel):
    taskId: str
    status: str
    completedAt: Optional[str] = None
    results: Optional[List[ResultItem]] = None


class AnalyzeResult(BaseModel):
    success: bool
    data: AnalyzeResultData
