from pydantic import BaseModel, ConfigDict, EmailStr

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