"""
DTOs (Data Transfer Objects) para módulo de prevalidadores
"""

from typing import Optional

from pydantic import BaseModel, Field


class PrevalidatorCreateDTO(BaseModel):
    """DTO para crear un prevalidador"""

    code: str = Field(..., max_length=20, description="Prevalidator code")
    customs_prevalidator: Optional[str] = Field(
        None, max_length=20, description="Customs prevalidator"
    )
    patent_prevalidator: Optional[str] = Field(
        None, max_length=20, description="Patent prevalidator"
    )
    description: Optional[str] = Field(
        None, max_length=50, description="Description"
    )

    class Config:
        from_attributes = True


class PrevalidatorUpdateDTO(BaseModel):
    """DTO para actualizar un prevalidador"""

    code: Optional[str] = Field(
        None, max_length=20, description="Prevalidator code"
    )
    customs_prevalidator: Optional[str] = Field(
        None, max_length=20, description="Customs prevalidator"
    )
    patent_prevalidator: Optional[str] = Field(
        None, max_length=20, description="Patent prevalidator"
    )
    description: Optional[str] = Field(
        None, max_length=50, description="Description"
    )

    class Config:
        from_attributes = True


class PrevalidatorResponseDTO(BaseModel):
    """DTO para responder con datos de un prevalidador"""

    id: int
    code: str
    customs_prevalidator: Optional[str] = None
    patent_prevalidator: Optional[str] = None
    description: Optional[str] = None

    class Config:
        from_attributes = True
