"""Base schema class for Pydantic models.

⚠️ AUTO-GENERATED BY PRISM - DO NOT EDIT
"""

from __future__ import annotations

from datetime import datetime

from pydantic import BaseModel, ConfigDict


class SchemaBase(BaseModel):
    """Base class for all Pydantic schemas."""

    model_config = ConfigDict(
        from_attributes=True,
        validate_assignment=True,
        arbitrary_types_allowed=True,
        str_strip_whitespace=True,
    )


class PaginatedResponse[T](BaseModel):
    """Paginated response wrapper."""

    items: list[T]
    total: int
    page: int
    page_size: int
    pages: int

    @property
    def has_next(self) -> bool:
        """Check if there's a next page."""
        return self.page < self.pages

    @property
    def has_prev(self) -> bool:
        """Check if there's a previous page."""
        return self.page > 1


class SortOrder(str):
    """Sort order enumeration."""

    ASC = "asc"
    DESC = "desc"


class SortParam(BaseModel):
    """Sorting parameter."""

    field: str
    order: str = "asc"


__all__ = ["PaginatedResponse", "SchemaBase", "SortOrder", "SortParam"]
