from enum import Enum from pydantic import BaseModel, Field from app.controllers.equipment.switch import SwitchSet from app.models.domain.feedback import FeedbackValue from app.schemas.equipment import ASHP, FeedWaterPump from app.schemas.equipment import VRFMode from app.schemas.season import Season class ThermalMode(str, Enum): cooling = "cooling" heating = "heating" hold = "hold" class Speed(str, Enum): off = "off" low = "low" medium = "medium" high = "high" hold = "hold" class ACATVIInstructionsRequest(BaseModel): device_id: str return_air_temperature: float | None running_status: bool | None work_mode: VRFMode current_speed: str | None current_temperature_set: float | None space_temperature_target: float | None space_realtime_temperature: float | None feedback: FeedbackValue on_time: str | None off_time: str | None class ACATVIInstructionsResponse(BaseModel): switch_set: str | None speed_set: str | None temperature_set: float | None class ACATVIModeRequest(BaseModel): season: Season space_temperature_list: list[float] class ACATVIModeResponse(BaseModel): mode: str class ACATFCInstructionsRequestBase(BaseModel): device_id: str season: str space_temperature_target: float | None space_realtime_temperature: float | None running_status: bool | None speed: Speed | None feedback: FeedbackValue class ACATFC2InstructionsRequest(ACATFCInstructionsRequestBase): pass class ACATFC4InstructionsRequest(ACATFCInstructionsRequestBase): pass class ACATFCInstructionsResponseBase(BaseModel): speed_set: str switch_set: str class ACATFC2InstructionsResponse(ACATFCInstructionsResponseBase): water_valve_set: str class ACATFC4InstructionsResponse(ACATFCInstructionsResponseBase): chill_water_valve_set: str hot_water_valve_set: str class ACATFCInstructionsResponse(BaseModel): switch_set: int = Field(None, alias="onOff") speed_set: int = Field(None, alias="speed") temperature_set: float = Field(None, alias="temperature") mode_set: int = Field(None, alias="mode") water_valve_switch_set: int = Field(None, alias="water") class ACATFCEarlyStartPredictionRequest(BaseModel): season: Season space_id: str | None device_id: str space_realtime_temperature: float | None outdoor_realtime_temperature: float | None class ACATFCEarlyStartPredictionResponse(BaseModel): minutes: float class ACATVIEarlyStartPredictionRequest(ACATFCEarlyStartPredictionRequest): pass class ACATVIEarlyStartPredictionResponse(ACATFCEarlyStartPredictionResponse): pass class Space(BaseModel): realtime_temperature: float | None class ACATVASpace(Space): temperature_target: float | None vav_default_weight: float | None vav_temporary_weight: float | None vav_temporary_update_time: str | None class ACATAHSpace(Space): temperature_target: float | None ahu_default_weight: float | None ahu_temporary_weight: float | None ahu_temporary_update_time: str | None class ACATFUSpace(Space): realtime_co2: float | None hcho: float | None class ACATVAInstructionsRequestBase(BaseModel): device_id: str spaces: list[ACATVASpace] class ACATVAInstructionsRequest(ACATVAInstructionsRequestBase): season: str supply_air_temperature: float | None acatah_supply_air_temperature: float | None supply_air_flow: float | None supply_air_flow_lower_limit: float | None supply_air_flow_upper_limit: float | None class ACATVAInstructionsRequestV2(ACATVAInstructionsRequestBase): season: str return_air_temperature: float | None class ACATVAInstructionsResponse(BaseModel): supply_air_flow_set: float = Field(None, alias="SupplyAirFlowSet") virtual_temperature_target_set: float = Field(None, alias="TargetTemperatureSet") virtual_realtime_temperature: float = Field(None, alias="VirtualRealtimeTemperature") class ACATVAInstructionsResponseV2(BaseModel): temperature_target_set: float virtual_target_temperature: float virtual_realtime_temperature: float class ACATAHFreqSetRequest(BaseModel): device_id: str system_supply_static_press: float | None system_supply_static_press_set: float | None current_freq_set: float | None supply_air_temperature_set_list: list[float] spaces_hot_rate: float | None class ACATAHFreqSetResponse(BaseModel): freq_set: float class ACATAHInstructionsRequest(BaseModel): device_id: str season: Season spaces: ACATAHSpace | None running_status: bool | None return_air_temperature: float | None return_air_temperature_set: float | None supply_air_temperature: float | None supply_air_temperature_set: float | None freq: float | None freq_set: float | None fan_freq_upper_limit_set: float | None fan_freq_lower_limit_set: float | None class ACATAHInstructionsResponse(BaseModel): switch_set: str return_air_temp_set: float | None supply_air_temp_set: float | None freq_set: float | None class SwitchSetRequestBase(BaseModel): device_id: str running_status: bool | None in_cloud_status: bool | None on_time: str | None off_time: str | None is_workday: bool | None class SwitchSetResponseBase(BaseModel): switch_set: SwitchSet class ACVTSFSwitchSetRequest(SwitchSetRequestBase): pass class ACVTSFSwitchSetResponse(SwitchSetResponseBase): pass class ACATFUSwitchSetRequest(SwitchSetRequestBase): break_start_time: str | None break_end_time: str | None class ACATFUCO2SwitchSetRequest(ACATFUSwitchSetRequest): co2_list: list[float] class ACATFUSwitchSetResponse(SwitchSetResponseBase): pass class ACATAHSwitchSetRequest(SwitchSetRequestBase): break_start_time: str | None break_end_time: str | None class ACATAHSwitchSetResponse(SwitchSetResponseBase): pass class VAV(BaseModel): id: str virtual_realtime_temperature: float | None virtual_temperature_target: float | None supply_air_flow_lower_limit: float | None supply_air_flow_upper_limit: float | None supply_air_flow_set: float | None supply_air_temperature: float | None valve_opening: float | None class ACATAHRequestBase(BaseModel): device_id: str season: str vav_list: list[VAV] class ACATAHThermalModeSetRequest(ACATAHRequestBase): pass class ACATAHThermalModeSetResponse(BaseModel): thermal_mode_set: ThermalMode class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase): supply_air_temperature: float | None supply_air_temperature_set: float | None return_air_temperature: float | None chill_water_valve_opening_set_list: list[float] hot_water_valve_opening_set_list: list[float] equip_switch_set_list: list[float] is_clear_day: bool | None class ACATAHSupplyAirTempSetResponse(BaseModel): supply_air_temperature_set: float class ACATFUSupplyAirTempSetRequest(BaseModel): device_id: str season: Season supply_air_temperature_set: float | None hot_ratio: float | None cold_ratio: float | None running_status_list: list[float] class ACATFUSupplyAirTempSetResponse(BaseModel): supply_air_temperature_set: float class ACATFUFreqSetRequest(BaseModel): device_id: str freq: float | None fresh_air_temperature: float | None spaces: list[ACATFUSpace] season: Season running_status_list: list[float] class ACATFUFreqSetResponse(BaseModel): freq_set: float class ASHPRequest(BaseModel): season: Season outdoor_temp: list[float] # 30min device_list: list[ASHP] class ASHPResponse(BaseModel): device_list: list[ASHP] interval: float is_warning: bool class FeedWaterPumpRequest(BaseModel): season: Season outdoor_temp: list[float] ashp_list: list[ASHP] pump_list: list[FeedWaterPump] class FeedWaterPumpResponse(BaseModel): device_list: list[FeedWaterPump]