"""
DTOs (Data Transfer Objects) para módulo de avisos electrónicos
"""

from typing import Optional

from pydantic import BaseModel, Field


class ElectronicNoticeCreateDTO(BaseModel):
    """DTO para crear un aviso electrónico"""

    notice_number: Optional[str] = Field(
        None, max_length=500, description="Notice number"
    )
    year: Optional[str] = Field(None, max_length=20, description="Year")
    patent: Optional[str] = Field(None, max_length=4, description="Patent")
    pedimento: Optional[str] = Field(
        None, max_length=15, description="Pedimento")
    file_sent: Optional[str] = Field(
        None, max_length=1000, description="File sent")
    file_response: Optional[str] = Field(
        None, max_length=1000, description="File response"
    )
    status: Optional[str] = Field(None, max_length=100, description="Status")
    invoice: Optional[str] = Field(None, max_length=50, description="Invoice")
    validation_acknowledgment: Optional[str] = Field(
        None, max_length=20, description="Validation acknowledgment"
    )
    fea: Optional[str] = Field(None, max_length=1000, description="FEA")
    certificate_number: Optional[str] = Field(
        None, max_length=50, description="Certificate number"
    )

    class Config:
        from_attributes = True


class ElectronicNoticeUpdateDTO(BaseModel):
    """DTO para actualizar un aviso electrónico"""

    notice_number: Optional[str] = Field(
        None, max_length=500, description="Notice number"
    )
    year: Optional[str] = Field(None, max_length=20, description="Year")
    patent: Optional[str] = Field(None, max_length=4, description="Patent")
    pedimento: Optional[str] = Field(
        None, max_length=15, description="Pedimento")
    file_sent: Optional[str] = Field(
        None, max_length=1000, description="File sent")
    file_response: Optional[str] = Field(
        None, max_length=1000, description="File response"
    )
    status: Optional[str] = Field(None, max_length=100, description="Status")
    invoice: Optional[str] = Field(None, max_length=50, description="Invoice")
    validation_acknowledgment: Optional[str] = Field(
        None, max_length=20, description="Validation acknowledgment"
    )
    fea: Optional[str] = Field(None, max_length=1000, description="FEA")
    certificate_number: Optional[str] = Field(
        None, max_length=50, description="Certificate number"
    )

    class Config:
        from_attributes = True


class ElectronicNoticeResponseDTO(BaseModel):
    """DTO para responder con datos de un aviso electrónico"""

    id: int
    notice_number: Optional[str] = None
    year: Optional[str] = None
    patent: Optional[str] = None
    pedimento: Optional[str] = None
    file_sent: Optional[str] = None
    file_response: Optional[str] = None
    status: Optional[str] = None
    invoice: Optional[str] = None
    validation_acknowledgment: Optional[str] = None
    fea: Optional[str] = None
    certificate_number: Optional[str] = None

    class Config:
        from_attributes = True
