from datetime import date, datetime
from typing import Optional

from pydantic import BaseModel, Field

from src.apps.base.schemas.common import BaseSchema
from src.apps.files.schemas.file import FileResponseSchema


class LoginRequest(BaseModel):
    identifier: str
    password: str
    keep_session: Optional[bool] = Field(default=False, description="Keep session active for 7 days")


class LoginResponse(BaseModel):
    access_token: str
    token_type: str
    expires_at: datetime


class UserLastSeenSchema(BaseModel):
    """
    Schema for user last seen.

    Attributes:
        last_seen (str): The last seen timestamp of the user.
    """

    last_seen: str

    class Config:
        from_attributes = True
        validate_default = True
        arbitrary_types_allowed = True


class AdminsSchema(BaseModel):
    """
    Schema for admin users.

    Attributes:
        user_id (str): The ID of the user.
        admin_id (str): The ID of the admin.
        created_at (Optional[str]): Timestamp of admin creation.
    """

    user_id: str
    admin_id: str
    created_at: Optional[str] = datetime.now()


class SuperAdminsSchema(BaseModel):
    """
    Schema for super admin users.

    Attributes:
        user_id (str): The ID of the user.
        super_admin_id (str): The ID of the super admin.
        created_at (Optional[str]): Timestamp of super admin creation.
    """

    user_id: str
    super_admin_id: str
    created_at: Optional[str] = datetime.now()


class UserRolesSchema(BaseModel):
    """
    Schema for user roles.

    Attributes:
        user_id (str): The ID of the user.
        role (str): The role assigned to the user.
        created_at (Optional[str]): Timestamp of role assignment.
    """

    user_id: str
    role: str
    created_at: Optional[str] = datetime.now()

