from enum import Enum from typing import Dict, List, Optional from pydantic import BaseModel, Field from app.controllers.equipment.switch import SwitchSet from app.models.domain.feedback import FeedbackValue from app.schemas.season import Season from app.schemas.space import SpaceATFU 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 DevicesInstructionsBaseResponse(BaseModel): project_id: str = Field(None, alias="projectId") device_id: str = Field(None, alias="equipId") output: Dict class DevicesEarlyStartTime(BaseModel): project_id: str = Field(None, alias="projectId") space_id: str = Field(None, alias="spaceId") minutes: float class ACATVIInstructionsRequest(BaseModel): device_id: str return_air_temperature: float running_status: bool work_mode: float current_speed: str current_temperature_set: float space_temperature_target: float space_realtime_temperature: float feedback: FeedbackValue on_time: str off_time: str class ACATVIInstructionsTemporaryResponse(BaseModel): output: Dict class ACATVIInstructionsResponse(BaseModel): switch_set: Optional[str] speed_set: Optional[str] temperature_set: Optional[float] # mode_set: Optional[str] 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 space_realtime_temperature: Optional[float] running_status: bool speed: Speed 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: Optional[str] device_id: str space_realtime_temperature: float outdoor_realtime_temperature: float class ACATFCEarlyStartPredictionResponse(BaseModel): minutes: float class Space(BaseModel): realtime_temperature: float temperature_target: float vav_default_weight: float vav_temporary_weight: float vav_temporary_update_time: str class ACATVAInstructionsRequestBase(BaseModel): device_id: str spaces: List[Space] class ACATVAInstructionsRequest(ACATVAInstructionsRequestBase): season: str supply_air_temperature: Optional[float] acatah_supply_air_temperature: Optional[float] supply_air_flow: Optional[float] supply_air_flow_lower_limit: Optional[float] supply_air_flow_upper_limit: Optional[float] class ACATVAInstructionsRequestV2(ACATVAInstructionsRequestBase): season: str # temperature_set: float return_air_temp: float 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 system_supply_static_press_set: float current_freq_set: float supply_air_temperature_set_list: List[float] spaces_hot_rate: float class ACATAHFreqSetResponse(BaseModel): freq_set: float class SwitchSetRequestBase(BaseModel): device_id: str running_status: bool in_cloud_status: bool on_time: str off_time: str is_workday: bool class SwitchSetResponseBase(BaseModel): switch_set: SwitchSet class ACVTSFSwitchSetRequest(SwitchSetRequestBase): pass class ACVTSFSwitchSetResponse(SwitchSetResponseBase): pass class ACATFUSwitchSetRequest(SwitchSetRequestBase): break_start_time: Optional[str] break_end_time: Optional[str] class ACATFUSwitchSetResponse(SwitchSetResponseBase): pass class ACATAHSwitchSetRequest(SwitchSetRequestBase): break_start_time: Optional[str] break_end_time: Optional[str] class ACATAHSwitchSetResponse(SwitchSetResponseBase): pass class VAV(BaseModel): id: str virtual_realtime_temperature: float virtual_temperature_target: float supply_air_flow_lower_limit: float supply_air_flow_upper_limit: float supply_air_flow_set: float valve_opening: float 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_set: float return_air_temperature: float chill_water_valve_opening_set_list: Optional[List[float]] hot_water_valve_opening_set_list: Optional[List[float]] equip_switch_set_list: Optional[List[float]] is_clear_day: Optional[bool] class ACATAHSupplyAirTempSetResponse(BaseModel): supply_air_temperature_set: float class ACATFUSupplyAirTempSetRequest(BaseModel): device_id: str season: Season supply_air_temperature_set: float hot_ratio: float cold_ratio: float running_status_list: List[float] class ACATFUSupplyAirTempSetResponse(BaseModel): supply_air_temperature_set: float class ACATFUFreqSetRequest(BaseModel): device_id: str freq: float fresh_air_temperature: float spaces: List[SpaceATFU] season: Season running_status_list: List[float] class ACATFUFreqSetResponse(BaseModel): freq_set: float