"""
项目容量信息schema
只提供返回，不提供更新接口
"""
from enum import Enum

from pydantic import BaseModel, Field
from typing import Optional, List
from ..common.base import BaseResponseWithID


class ProjectDetailKey(str, Enum):
    """项目子类类型枚举"""
    PLAN_CONSTRUCTION = "plan_construction"  # 计划在建容量
    ACTUAL_CONSTRUCTION = "actual_construction"  # 实际在建容量
    PRODUCTION = "production"  # 投产容量
    ENSURE_PRODUCTION = "ensure_production"  # 确保容量
    CLIMB_PRODUCTION = "climb_production"  # 登高容量
    CHALLENGE_PRODUCTION = "challenge_production"  # 揭榜容量
    COMPLETE_INVESTMENT = "complete_investment"  # 完成投资容量


class CapacityItem(BaseModel):
    year: Optional[int] = Field(None, description='年')
    date: Optional[str] = Field(None, description="日期，格式YYYY-MM-DD")
    capacity: float = Field(..., description='容量')
    is_audit: Optional[bool] = Field(False, description='是否可编辑')


class ProjectDetailProject(BaseResponseWithID):
    project_id:str= Field(..., description="所属项目ID", examples=["project123"])
    key: Optional[ProjectDetailKey] = Field(None, description='项目子类类型')
    value: Optional[List[CapacityItem]] = Field(None, description='项目子类类型值')
