from typing import List, Optional
from datetime import datetime
from pydantic import BaseModel, Field

from pif_compiler.classes.base_classes import ExpositionInfo, SedTable, ProdCompany, Ingredient
from pif_compiler.classes.types_enum import CosmeticType, PhysicalForm, NormalUser

class PIF(BaseModel):
    # INFORMAZIONI GENERALI DEL PRODOTTO
    
    # Data di esecuzione pif = datetime.now()
    created_at: datetime = Field(
        default_factory=lambda: datetime.strptime(
           datetime.now().strftime('%Y-%m-%d'), 
           '%Y-%m-%d'
        )
    )
    
    # Informazioni del prodotto
    company: str
    product_name: str
    type: CosmeticType
    physical_form: PhysicalForm
    CNCP: int
    production_company: ProdCompany
    
    # Ingredienti
    ingredients: List[Ingredient] # str = quantità decimale %
    normal_consumer: Optional[NormalUser]
    exposition: Optional[ExpositionInfo]
    
    # Informazioni di sicurezza
    sed_table: Optional[SedTable] = None
    undesired_effets: Optional[str] = None
    description: Optional[str] = None
    warnings: Optional[List[str]] = None