from datetime import datetime
from typing import Optional

from pydantic import BaseModel, Field


class BaseIndustry(BaseModel):
    code: str = Field(..., description="行业代码", example="001")
    name: str = Field(..., description="行业名称", example="农业")
    roe: float = Field(0, description="平均ROE", example=0.15)
    fix_num: float = Field(0, description="行业修正系数", example=1.2)
    remark: str = Field("备注", description="备注", example="行业修正系数说明")


class IndustryCreate(BaseIndustry):
    pass


class IndustryUpdate(BaseIndustry):
    id: int


class IndustryResponse(BaseIndustry):
    id: int
    created_at: Optional[datetime]
    updated_at: Optional[datetime]