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


class CamelModel(BaseModel):
    """所有小程序 API 响应 schema 的基类。

    - alias_generator=to_camel：JSON 输出字段名自动转 camelCase
    - populate_by_name=True：同时接受 snake_case 和 camelCase 输入
    - from_attributes=True：支持从 ORM 对象/dict 构造
    """

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