from typing import Dict

from pydantic import BaseModel

INTERNATIONAL_KEY = [
    "rec_name_01",
    "rec_name_02",
    "instruction_01",
    "instruction_02",
    "IF",
    "THEN",
    "date",
    "time",
    "103",
    "104",
    "105",
    "106",
    "1",
    "2",
    "3",
    "4",
    "5",
    "6",
    "7",
    "weather",
    "irradiance",
    "temperature",
    "humidity",
    "wind",
    "barometricPressure",
    "rain",
    "108",
    "109",
    "forcastRain",
    "100",
    "101",
    "102",
    "electricityPrice",
    "buyingPrice",
    "sellingPrice",
    "price",
    "lowerPrice",
    "higherPrice",
    "expensiveHours",
    "cheapestHours",
    "system",
    "systemSwitch",
    "on",
    "off",
    "exportControl",
    "exportControlOff",
    "total",
    "per phase",
    "importControl_AELIO",
    "importControl",
    "importControl_standby",
    "importControl_discharge",
    "importControlOff",
    "workMode",
    "Self-use",
    "Feedin priority",
    "Back up mode",
    "Manual mode",
    "Forced charging",
    "Forced discharging",
    "Stop charging and discharging",
    "Peak Shaving",
    "VPP",
    "Power Control Mode",
    "Electric Quantity Target Control Mode",
    "SOC Target Control Mode",
    "Push Power - Positive/Negative Mode",
    "Push Power - Zero Mode",
    "Self-Consume - Charge/Discharge Mode",
    "Self-Consume - Charge Only Mode",
    "PV&BAT Individual Setting – Duration Mode",
    "PV&BAT Individual Setting – Target SOC Mode",
    "DoControl",
    "duration",
    "systemSoc",
    "systemImportPower",
    "systemExportPower",
    "cabinetSoc",
    "cabinetAlarm",
    "OR",
    "AND",
    "tips_alarm",
    "normal_alarm",
    "emergency_alarm",
    "pcs",
    "bms",
    "elm",
    "io",
    "air_conditioner",
    "liquid_cooling_unit",
    "environment_monitoring",
    "ess",
]


class SmartSceneBaseModel(BaseModel):
    _international_map: Dict[str, str] = {key: {} for key in INTERNATIONAL_KEY}

    @classmethod
    def set_internation_map(cls, map_data: Dict[str, str]):
        """Set the internationalization map for the model."""
        cls._international_map = map_data

    @classmethod
    def translate(cls, key: str, lang: str) -> str:
        """Translate a key to the specified language."""
        return cls._international_map.get(key, {}).get(lang, key)
