from datetime import datetime
from typing import Optional

from pydantic import BaseModel, Field

from app.models.enums import ESGType


class BaseESG(BaseModel):
    code: str = Field(..., description="行业代码", example="001")
    name: str = Field(..., description="行业名称", example="农业")
    level: ESGType = Field(..., description="ESG价值等级", example=ESGType.A)
    number: int = Field(0, description="ESG基准分", example=85)
    remark: str = Field("简要说明（ESG视角）", description="备注", example="环保友好型行业")


class ESGCreate(BaseESG):
    pass


class ESGUpdate(BaseESG):
    id: int


class ESGResponse(BaseESG):
    id: int
    created_at: Optional[datetime]
    updated_at: Optional[datetime]