from typing import Dict
from .FieldName import FieldName

FIELD_UNIT: Dict[FieldName, str] = {
    FieldName.AC_INPUT_CURRENT: "A",
    FieldName.AC_INPUT_FREQUENCY: "Hz",
    FieldName.AC_INPUT_POWER: "W",
    FieldName.AC_INPUT_VOLTAGE: "V",
    FieldName.AC_OUTPUT_CURRENT: "A",
    FieldName.AC_OUTPUT_FREQUENCY: "Hz",
    FieldName.AC_OUTPUT_POWER: "W",
    FieldName.AC_OUTPUT_VOLTAGE: "V",
    FieldName.AC_P1_CURRENT: "A",
    FieldName.AC_P1_POWER: "W",
    FieldName.AC_P1_VOLTAGE: "V",
    FieldName.AC_P2_CURRENT: "A",
    FieldName.AC_P2_POWER: "W",
    FieldName.AC_P2_VOLTAGE: "V",
    FieldName.AC_P3_CURRENT: "A",
    FieldName.AC_P3_POWER: "W",
    FieldName.AC_P3_VOLTAGE: "V",
    FieldName.BATTERY_SOC: "%",
    FieldName.BATTERY_SOC_RANGE_END: "%",
    FieldName.BATTERY_SOC_RANGE_START: "%",
    FieldName.CTRL_ECO_MIN_POWER_AC: "W",
    FieldName.CTRL_ECO_MIN_POWER_DC: "W",
    FieldName.DC_INPUT_CURRENT: "A",
    FieldName.DC_INPUT_POWER: "W",
    FieldName.DC_INPUT_VOLTAGE: "V",
    FieldName.DC_OUTPUT_POWER: "W",
    FieldName.GRID_FREQUENCY: "Hz",
    FieldName.GRID_P1_CURRENT: "A",
    FieldName.GRID_P1_POWER: "W",
    FieldName.GRID_P1_VOLTAGE: "V",
    FieldName.GRID_P2_CURRENT: "A",
    FieldName.GRID_P2_POWER: "W",
    FieldName.GRID_P2_VOLTAGE: "V",
    FieldName.GRID_P3_CURRENT: "A",
    FieldName.GRID_P3_POWER: "W",
    FieldName.GRID_P3_VOLTAGE: "V",
    FieldName.INTERNAL_AC_FREQUENCY: "Hz",
    FieldName.INTERNAL_AC_VOLTAGE: "V",
    FieldName.INTERNAL_DC_INPUT_CURRENT: "A",
    FieldName.INTERNAL_DC_INPUT_POWER: "W",
    FieldName.INTERNAL_DC_INPUT_VOLTAGE: "V",
    FieldName.POWER_GENERATION: "kWh",
    FieldName.PV_S1_CURRENT: "A",
    FieldName.PV_S1_POWER: "W",
    FieldName.PV_S1_VOLTAGE: "V",
    FieldName.PV_S2_CURRENT: "A",
    FieldName.PV_S2_POWER: "W",
    FieldName.PV_S2_VOLTAGE: "V",
    FieldName.SM_P1_CURRENT: "A",
    FieldName.SM_P1_POWER: "W",
    FieldName.SM_P1_VOLTAGE: "V",
    FieldName.SM_P2_CURRENT: "A",
    FieldName.SM_P2_POWER: "W",
    FieldName.SM_P2_VOLTAGE: "V",
    FieldName.SM_P3_CURRENT: "A",
    FieldName.SM_P3_POWER: "W",
    FieldName.SM_P3_VOLTAGE: "V",
    FieldName.TIME_REMAINING: "h",
}


def get_unit(field: FieldName) -> str | None:
    return FIELD_UNIT.get(field)
