"""Constants for the Indevolt integration."""

from typing import Final

from indevolt_api import (
    IndevoltBattery,
    IndevoltConfig,
    IndevoltGrid,
    IndevoltSolar,
    IndevoltSystem,
)

DOMAIN: Final = "indevolt"

# Default configurations
DEFAULT_PORT: Final = 8080

# Config entry fields
CONF_SERIAL_NUMBER: Final = "serial_number"
CONF_GENERATION: Final = "generation"

# API key fields
SENSOR_KEYS: Final[dict[int, list[str]]] = {
    1: [
        IndevoltSystem.OPERATING_MODE,
        IndevoltConfig.READ_ENERGY_MODE,
        IndevoltSystem.INPUT_POWER,
        IndevoltSystem.OUTPUT_POWER,
        IndevoltSystem.TOTAL_INPUT_ENERGY,
        IndevoltSystem.TOTAL_OUTPUT_ENERGY,
        IndevoltBattery.POWER,
        IndevoltSystem.OFF_GRID_OUTPUT_ENERGY,
        IndevoltSystem.BYPASS_POWER,
        IndevoltSystem.BYPASS_INPUT_ENERGY,
        IndevoltBattery.RATED_CAPACITY,
        IndevoltBattery.DAILY_CHARGING_ENERGY,
        IndevoltBattery.DAILY_DISCHARGING_ENERGY,
        IndevoltBattery.TOTAL_CHARGING_ENERGY,
        IndevoltBattery.TOTAL_DISCHARGING_ENERGY,
        IndevoltBattery.CHARGE_DISCHARGE_STATE,
        IndevoltBattery.SOC,
        IndevoltSolar.DC_OUTPUT_POWER,
        IndevoltSolar.DAILY_PRODUCTION,
        IndevoltSolar.DC_INPUT_POWER_1,
        IndevoltSolar.DC_INPUT_VOLTAGE_1,
        IndevoltSolar.DC_INPUT_CURRENT_1,
        IndevoltSolar.DC_INPUT_POWER_2,
        IndevoltSolar.DC_INPUT_VOLTAGE_2,
        IndevoltSolar.DC_INPUT_CURRENT_2,
        IndevoltSolar.DC_INPUT_POWER_3,
        IndevoltSolar.DC_INPUT_POWER_4,
        IndevoltConfig.READ_DISCHARGE_LIMIT,
        IndevoltConfig.READ_REALTIME_COMMAND,
        IndevoltConfig.READ_REALTIME_TARGET_SOC,
        IndevoltConfig.READ_REALTIME_POWER_LIMIT,
        IndevoltGrid.METER_POWER_GEN1,
        IndevoltGrid.METER_CONNECTED,
        IndevoltSolar.CUMULATIVE_PRODUCTION,
        IndevoltSystem.HEATING_STATE,
        IndevoltBattery.GEN_1_INVERTER_TEMPERATURE,
        IndevoltBattery.GEN_1_PACK_1_TEMPERATURE,
        IndevoltBattery.GEN_1_PACK_2_TEMPERATURE,
        IndevoltBattery.GEN_1_PACK_3_TEMPERATURE,
        IndevoltBattery.GEN_1_MOS_TEMPERATURE_CHARGE,
        IndevoltBattery.GEN_1_MOS_TEMPERATURE_DISCHARGE,
    ],
    2: [
        IndevoltSystem.OPERATING_MODE,
        IndevoltConfig.READ_ENERGY_MODE,
        IndevoltSystem.INPUT_POWER,
        IndevoltSystem.OUTPUT_POWER,
        IndevoltSystem.TOTAL_INPUT_ENERGY,
        IndevoltBattery.POWER,
        IndevoltBattery.CHARGE_DISCHARGE_STATE,
        IndevoltBattery.SOC,
        IndevoltSolar.DC_OUTPUT_POWER,
        IndevoltSolar.DAILY_PRODUCTION,
        IndevoltSolar.DC_INPUT_POWER_1,
        IndevoltSolar.DC_INPUT_POWER_2,
        IndevoltSolar.DC_INPUT_POWER_3,
        IndevoltSolar.DC_INPUT_POWER_4,
        IndevoltBattery.RATED_CAPACITY,
        IndevoltSystem.BYPASS_POWER,
        IndevoltSystem.TOTAL_OUTPUT_ENERGY,
        IndevoltSystem.OFF_GRID_OUTPUT_ENERGY,
        IndevoltSystem.BYPASS_INPUT_ENERGY,
        IndevoltBattery.DAILY_CHARGING_ENERGY,
        IndevoltBattery.DAILY_DISCHARGING_ENERGY,
        IndevoltBattery.TOTAL_CHARGING_ENERGY,
        IndevoltBattery.TOTAL_DISCHARGING_ENERGY,
        IndevoltGrid.METER_POWER_GEN2,
        IndevoltGrid.VOLTAGE,
        IndevoltGrid.FREQUENCY,
        IndevoltSolar.DC_INPUT_CURRENT_1,
        IndevoltSolar.DC_INPUT_VOLTAGE_1,
        IndevoltSolar.DC_INPUT_CURRENT_2,
        IndevoltSolar.DC_INPUT_VOLTAGE_2,
        IndevoltSolar.DC_INPUT_CURRENT_3,
        IndevoltSolar.DC_INPUT_VOLTAGE_3,
        IndevoltSolar.DC_INPUT_CURRENT_4,
        IndevoltSolar.DC_INPUT_VOLTAGE_4,
        IndevoltBattery.MAIN_SERIAL_NUMBER,
        IndevoltBattery.PACK_1_SERIAL_NUMBER,
        IndevoltBattery.PACK_2_SERIAL_NUMBER,
        IndevoltBattery.PACK_3_SERIAL_NUMBER,
        IndevoltBattery.PACK_4_SERIAL_NUMBER,
        IndevoltBattery.PACK_5_SERIAL_NUMBER,
        IndevoltBattery.MAIN_SOC,
        IndevoltBattery.PACK_1_SOC,
        IndevoltBattery.PACK_2_SOC,
        IndevoltBattery.PACK_3_SOC,
        IndevoltBattery.PACK_4_SOC,
        IndevoltBattery.PACK_5_SOC,
        IndevoltBattery.MAIN_TEMPERATURE,
        IndevoltBattery.PACK_1_TEMPERATURE,
        IndevoltBattery.PACK_2_TEMPERATURE,
        IndevoltBattery.PACK_3_TEMPERATURE,
        IndevoltBattery.PACK_4_TEMPERATURE,
        IndevoltBattery.PACK_5_TEMPERATURE,
        IndevoltBattery.MAIN_MOS_TEMPERATURE,
        IndevoltBattery.PACK_1_MOS_TEMPERATURE,
        IndevoltBattery.PACK_2_MOS_TEMPERATURE,
        IndevoltBattery.PACK_3_MOS_TEMPERATURE,
        IndevoltBattery.PACK_4_MOS_TEMPERATURE,
        IndevoltBattery.PACK_5_MOS_TEMPERATURE,
        IndevoltBattery.MAIN_VOLTAGE,
        IndevoltBattery.PACK_1_VOLTAGE,
        IndevoltBattery.PACK_2_VOLTAGE,
        IndevoltBattery.PACK_3_VOLTAGE,
        IndevoltBattery.PACK_4_VOLTAGE,
        IndevoltBattery.PACK_5_VOLTAGE,
        IndevoltBattery.MAIN_CURRENT,
        IndevoltBattery.PACK_1_CURRENT,
        IndevoltBattery.PACK_2_CURRENT,
        IndevoltBattery.PACK_3_CURRENT,
        IndevoltBattery.PACK_4_CURRENT,
        IndevoltBattery.PACK_5_CURRENT,
        IndevoltBattery.MAIN_CYCLES,
        IndevoltBattery.PACK_1_CYCLES,
        IndevoltBattery.PACK_2_CYCLES,
        IndevoltBattery.PACK_3_CYCLES,
        IndevoltBattery.PACK_4_CYCLES,
        IndevoltBattery.PACK_5_CYCLES,
        IndevoltConfig.READ_BYPASS,
        IndevoltConfig.READ_GRID_CHARGING,
        IndevoltConfig.READ_LIGHT,
        IndevoltConfig.READ_MAX_AC_OUTPUT_POWER,
        IndevoltConfig.READ_INVERTER_INPUT_LIMIT,
        IndevoltConfig.READ_FEEDIN_POWER_LIMIT,
        IndevoltConfig.READ_DISCHARGE_LIMIT,
        IndevoltConfig.READ_REALTIME_COMMAND,
        IndevoltConfig.READ_REALTIME_TARGET_SOC,
        IndevoltConfig.READ_REALTIME_POWER_LIMIT,
        IndevoltBattery.MAIN_HEATING_STATE,
        IndevoltBattery.PACK_1_HEATING_STATE,
        IndevoltBattery.PACK_2_HEATING_STATE,
        IndevoltBattery.PACK_3_HEATING_STATE,
        IndevoltBattery.PACK_4_HEATING_STATE,
        IndevoltBattery.PACK_5_HEATING_STATE,
        IndevoltGrid.METER_CONNECTED,
        IndevoltSolar.CUMULATIVE_PRODUCTION,
        IndevoltBattery.GEN_2_CYCLE_COUNT,
        IndevoltBattery.GEN_2_TRANSFORMER_TEMPERATURE,
        IndevoltBattery.REMAINING_CHARGING_TIME,
        IndevoltBattery.REMAINING_DISCHARGING_TIME,
    ],
}
