"""
Base schema configuration for Munal LMS Pydantic models.

Provides APIBaseModel with automatic camelCase alias generation and
bidirectional field population, bridging JavaScript frontend conventions
with Pythonic snake_case domain schemas.
"""

from pydantic import BaseModel, ConfigDict
from pydantic.alias_generators import to_camel


class APIBaseModel(BaseModel):
    """
    Standard base model for all request/response schemas.

    - alias_generator=to_camel: Output JSON keys are camelCase (e.g. patientName).
    - populate_by_name=True: Accepts both snake_case (Python internal) and camelCase (JS client).
    - from_attributes=True: Enables seamless ORM-to-schema serialization (ORM mode).
    """

    model_config = ConfigDict(
        alias_generator=to_camel,
        populate_by_name=True,
        from_attributes=True,
    )
