from __future__ import annotations

from typing import List, Optional

from pydantic import BaseModel, Field


class DodaAltaLogCreateDTO(BaseModel):
    doda_id: Optional[int] = None
    variant: Optional[str] = Field(None, max_length=10)
    action: Optional[str] = Field(None, max_length=20)
    responsible: Optional[str] = Field(None, max_length=20)
    patent: Optional[str] = Field(None, max_length=10)
    dispatch_customs: Optional[str] = Field(None, max_length=10)
    operation_type: Optional[str] = Field(None, max_length=5)
    integration_number: Optional[str] = Field(None, max_length=50)
    task_id: Optional[str] = Field(None, max_length=255)
    status: Optional[str] = Field(None, max_length=30)
    message: Optional[str] = Field(None, max_length=2000)
    result_json: Optional[str] = None


class DodaAltaLogUpdateDTO(BaseModel):
    status: Optional[str] = Field(None, max_length=30)
    message: Optional[str] = Field(None, max_length=2000)
    result_json: Optional[str] = None


class DodaAltaLogResponseDTO(BaseModel):
    id: int
    doda_id: Optional[int] = None
    variant: Optional[str] = None
    action: Optional[str] = None
    responsible: Optional[str] = None
    patent: Optional[str] = None
    dispatch_customs: Optional[str] = None
    operation_type: Optional[str] = None
    integration_number: Optional[str] = None
    task_id: Optional[str] = None
    status: Optional[str] = None
    message: Optional[str] = None
    result_json: Optional[str] = None
    company_id: int
    tenant_id: int
    created_at: Optional[str] = None
    updated_at: Optional[str] = None

    model_config = {"from_attributes": True}


class DodaAltaLogListResponse(BaseModel):
    items: List[DodaAltaLogResponseDTO]
    total: int
    page: int
    page_size: int
