"""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,
        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,
        IndevoltConfig.READ_DISCHARGE_LIMIT,
        IndevoltGrid.METER_POWER_GEN1,
        IndevoltGrid.METER_CONNECTED,
        IndevoltSolar.CUMULATIVE_PRODUCTION,
        IndevoltSystem.HEATING_STATE,
    ],
    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_GEN2,
        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_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,
        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,
        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,
    ],
}
