"""User and Auth schemas."""
from pydantic import BaseModel, EmailStr
from typing import Optional
from uuid import UUID
from app.models.user import UserRole, VehicleType


class UserBase(BaseModel):
    email: EmailStr
    full_name: str
    profile_photo_url: Optional[str] = None


class UserUpdate(BaseModel):
    full_name: Optional[str] = None
    password: Optional[str] = None
    profile_photo_url: Optional[str] = None


class PassengerCreate(UserBase):
    password: str


class DriverProfileBase(BaseModel):
    cedula: str
    vehicle_type: VehicleType
    license_plate: str
    cooperative_name: Optional[str] = None


class DriverCreate(UserBase):
    password: str
    cedula: str
    vehicle_type: VehicleType
    license_plate: str
    cooperative_name: Optional[str] = None
    # Photos will be handled via UploadFile in FastAPI, not in the Pydantic schema for JSON data


class UserResponse(UserBase):
    id: UUID
    role: UserRole
    is_active: bool
    is_verified: bool

    class Config:
        from_attributes = True


class LoginRequest(BaseModel):
    email: str
    password: str
    keep_session: bool = False


class GoogleLoginRequest(BaseModel):
    id_token: str


class Token(BaseModel):
    access_token: str
    token_type: str
    role: str
    full_name: str
    profile_photo_url: Optional[str] = None
