"""查重 API Pydantic schemas。"""

from __future__ import annotations

from pydantic import BaseModel, Field


class DuplicateSegmentResponse(BaseModel):
    """重复片段响应。"""

    id: str
    source_start: float
    source_end: float
    matched_video_id: str
    matched_video_name: str
    matched_start: float
    matched_end: float
    similarity: float


class DuplicationRecordResponse(BaseModel):
    """查重记录响应（列表项）。"""

    id: str
    filename: str
    file_size: int
    duration_seconds: float = 0.0
    status: str = "pending"
    duplicate_rate: float | None = None
    duplicate_count: int = 0
    created_at: str
    updated_at: str


class DuplicationDetailResponse(DuplicationRecordResponse):
    """查重详情响应（含重复片段）。"""

    segments: list[DuplicateSegmentResponse] = Field(default_factory=list)


class DuplicationUploadResponse(BaseModel):
    """上传查重响应。"""

    id: str
    status: str
    message: str
