from pydantic import BaseModel, Field
from typing import Any, Optional, List


class ResponseBase(BaseModel):
    error: Optional[str] = None
    detail: Optional[str] = None


class ErrorResponse(BaseModel):
    error: str
    detail: Optional[str] = None


class PaginatedResponse(BaseModel):
    items: List[Any] = []
    total: int = 0
    page: int = 1
    pageSize: int = 20


class PaginatedListResponse(BaseModel):
    list: List[Any] = Field(default_factory=list, alias="list")
    total: int = 0
    page: int = 1
    pageSize: int = 20

    model_config = {"populate_by_name": True}


class SuccessResponse(BaseModel):
    success: bool = True
    message: Optional[str] = None
