# /opt/docker/dev/service_finder/backend/app/schemas/asset.py
from pydantic import BaseModel, ConfigDict, Field
from typing import Optional, Dict, Any, List
from uuid import UUID
from datetime import datetime

class AssetCatalogResponse(BaseModel):
    """ A technikai katalógus (Master Data) teljes adattartalma. """
    id: int
    make: str
    model: str
    generation: Optional[str] = None
    engine_variant: Optional[str] = None
    year_from: Optional[int] = None
    year_to: Optional[int] = None
    vehicle_class: Optional[str] = None
    fuel_type: Optional[str] = None
    
    # Technikai paraméterek az automatizáláshoz
    power_kw: Optional[int] = None
    engine_capacity: Optional[int] = None
    max_weight_kg: Optional[int] = None
    axle_count: Optional[int] = None
    euro_class: Optional[str] = None
    body_type: Optional[str] = None
    engine_code: Optional[str] = None
    
    factory_data: Dict[str, Any] = Field(default_factory=dict)
    
    model_config = ConfigDict(from_attributes=True)

class AssetResponse(BaseModel):
    """ A konkrét járműpéldány (Asset) teljes válaszmodellje. """
    id: UUID
    vin: str = Field(..., min_length=17, max_length=17)
    license_plate: Optional[str] = None
    name: Optional[str] = None
    year_of_manufacture: Optional[int] = None
    
    # Státusz és ellenőrzés
    status: str
    is_verified: bool
    verification_method: Optional[str] = None
    catalog_match_score: Optional[float] = None
    
    # Kapcsolt adatok
    catalog_id: Optional[int] = None
    catalog: Optional[AssetCatalogResponse] = None # Itt jön a dúsítás!
    
    owner_organization_id: Optional[int] = None
    operator_person_id: Optional[int] = None
    
    created_at: datetime
    updated_at: Optional[datetime] = None
    
    model_config = ConfigDict(from_attributes=True)