solorpower/api_server/app/schemas/stats.py
haneulai a716dbef96
Some checks are pending
CI / Crawler (Python ${{ matrix.python-version }}) (3.10) (push) Waiting to run
CI / Crawler (Python ${{ matrix.python-version }}) (3.11) (push) Waiting to run
CI / API (Python 3.11) (push) Waiting to run
CI / Database migration (push) Waiting to run
CI / App web build (Node 20) (push) Waiting to run
feat: harden solar monitoring through stage 7
2026-08-07 14:07:22 +09:00

51 lines
950 B
Python

"""통계 API 응답 스키마."""
from typing import List, Literal
from pydantic import BaseModel
class ComparisonStatItem(BaseModel):
plant_id: str
plant_name: str
capacity: float
generation: float
generation_hours: float
class ComparisonStatsResponse(BaseModel):
status: Literal["success"]
period: Literal["day", "month", "year"]
target_date: str
data: List[ComparisonStatItem]
count: int
class StatPoint(BaseModel):
label: str
value: float
class PlantStatsResponse(BaseModel):
status: Literal["success"]
plant_id: str
period: Literal["day", "month", "year"]
data: List[StatPoint]
count: int
class HourlyStatPoint(BaseModel):
hour: int
label: str
current_kw: float
today_kwh: float
has_data: bool
class HourlyStatsResponse(BaseModel):
status: Literal["success"]
plant_id: str
date: str
data: List[HourlyStatPoint]
count: int