from pydantic import BaseModel, ConfigDict, Field
from typing import Optional

class UserCreate(BaseModel):
    username: str = Field(..., min_length=3, max_length=50)
    password: str = Field(..., min_length=6)
    role: Optional[str] = "usuario"  

class UserLogin(BaseModel):
    username: str
    password: str

class UserResponse(BaseModel):
    username: str
    role: str

class UserInDB(BaseModel):
    id: Optional[str] = Field(alias="_id")
    username: str
    password: str
    role: str

    model_config = ConfigDict(validate_by_name=True)
