from datetime import datetime
from typing import List, Literal
from pydantic import EmailStr, Field
from app.utils.schemas_utils import CustomModel

class UserCreate(CustomModel):
    first_name: str
    last_name: str
    email_id: str
    password: str

class UserCreateLink(CustomModel):
    first_name: str
    last_name: str
    email_id: str
    mobile_number: int

class UserResponseInstitution(CustomModel):
    user_id: int
    first_name: str
    last_name: str
    email_id: str
    mobile_number: int

class UserLoginBase(CustomModel):
    email_id: EmailStr
    password: str

class UserPassUpdate(CustomModel):
    current_password: str
    new_password: str
    confirm_password: str

class UserResponse(CustomModel):
    first_name: str
    last_name: str
    email_id: str
    password: str
    role: Literal["superadmin", "admin"] = Field(default="admin")

class ForgotPasswordRequest(CustomModel):
    email_id: EmailStr

class VerifyOTPRequest(CustomModel):
    email_id: EmailStr
    otp: str

class NewPass(CustomModel):
    email_id: EmailStr
    old_password: str
    new_password: str

class Role(CustomModel):
    role: str

class Id(CustomModel):
    simulation_id: int

class SimulationResponse(CustomModel):
    simulation_id: int
    simulation_name: str
    description: str
    status: Literal["Active", "Pending", "Completed"] = Field(default="Pending")
    start_date: datetime
    end_date: datetime
    category: List[int]
    institution: str
    location: str
    simulation_code: str

class InstitutionMiniResponses(CustomModel):
    institution_id: int
    institutions_name: str
    members_count: int
    simulation_count: int

class UserAdminInstitutionResponse(CustomModel):
    user_id: int
    first_name: str
    last_name: str
    email_id: str
    modile_number: str
    institutions: List[InstitutionMiniResponses]
