from decimal import Decimal
from typing import List, Optional

from pydantic import BaseModel, Field


class ConceptManifestationBaseDTO(BaseModel):
    value_manifestation_id: int = Field(..., description="Value Manifestation ID")
    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="Number")
    merchandise_provider: Optional[str] = Field(None, max_length=100, description="Merchandise provider")
    invoice_document: Optional[str] = Field(None, max_length=200, description="Invoice document")
    amount: Optional[Decimal] = Field(None, description="Amount")
    currency: Optional[str] = Field(None, max_length=3, description="Currency")
    concept_load: Optional[str] = Field(None, max_length=200, description="Concept load")


class ConceptManifestationCreateDTO(ConceptManifestationBaseDTO):
    pass


class ConceptManifestationUpdateDTO(BaseModel):
    attachment_type: Optional[str] = Field(None, max_length=10, description="Attachment type")
    number: Optional[str] = Field(None, max_length=10, description="Number")
    merchandise_provider: Optional[str] = Field(None, max_length=100, description="Merchandise provider")
    invoice_document: Optional[str] = Field(None, max_length=200, description="Invoice document")
    amount: Optional[Decimal] = Field(None, description="Amount")
    currency: Optional[str] = Field(None, max_length=3, description="Currency")
    concept_load: Optional[str] = Field(None, max_length=200, description="Concept load")


class ConceptManifestationResponseDTO(ConceptManifestationBaseDTO):
    tenant_id: int
    company_id: int

    class Config:
        from_attributes = True


class ConceptManifestationListDTO(BaseModel):
    items: List[ConceptManifestationResponseDTO]
    total: int
    page: int
    page_size: int

    class Config:
        from_attributes = True
