from typing import List, Optional
from pydantic import BaseModel, Field


class ManifestAnexoBaseDTO(BaseModel):
    consecutive: int = Field(..., description="Consecutive number")
    line_number: int = Field(..., description="Line number")
    attachment_type: Optional[str] = Field(None, max_length=10, description="Attachment type")
    number: Optional[str] = Field(None, max_length=10, description="Attachment number")
    attached_doc: Optional[str] = Field(None, max_length=200, description="Attached document path/name")


class ManifestAnexoCreateDTO(ManifestAnexoBaseDTO):
    pass


class ManifestAnexoUpdateDTO(ManifestAnexoBaseDTO):
    consecutive: Optional[int] = Field(None)
    line_number: Optional[int] = Field(None)


class ManifestAnexoResponseDTO(ManifestAnexoBaseDTO):
    tenant_id: int
    company_id: int

    class Config:
        from_attributes = True


class ManifestAnexoListDTO(BaseModel):
    items: List[ManifestAnexoResponseDTO]
    total: int
    page: int
    page_size: int

    class Config:
        from_attributes = True
