from pydantic import BaseModel, ConfigDict, EmailStr
from uuid import UUID
from datetime import date
class RoleBase(BaseModel):
    name: str

class UserBase(BaseModel):
    firstname: str
    lastname: str
    email: EmailStr
    hashed_password: str
    role_id: int 
    is_active: bool = True
    
class RoleCreate(RoleBase):
    pass

class UserCreate(UserBase):
    pass

class User(UserBase):
    model_config = ConfigDict(from_attributes=True)
    id: int

class Role(RoleBase):
    model_config = ConfigDict(from_attributes=True)
    id: int


class Object(BaseModel):
    model_config = ConfigDict(from_attributes=True)
    id: UUID
    id_city: int
    id_parent: UUID | None 
    year: int | None


class Value(BaseModel):
    model_config = ConfigDict(from_attributes=True)
    id: int
    id_object: UUID
    id_param: int
    value: str|None 
    date_s: date
    date_po: date|None
    id_user: int