"""Register definitions for Victron VE.Bus Inverter/Charger (unit ID 227)."""

from .base import DeviceParser, RegisterDefinition, RegisterType


class VEBusParser(DeviceParser):
    """Parser for VE.Bus inverter/charger registers."""

    @property
    def device_type(self) -> str:
        return "vebus"

    @property
    def product_name(self) -> str:
        return "Victron VE.Bus Inverter"

    @property
    def registers(self) -> tuple[RegisterDefinition, ...]:
        return (
            RegisterDefinition("ac_input_voltage", 3, scale=10),
            RegisterDefinition("ac_input_current", 6, RegisterType.INT16, scale=10),
            RegisterDefinition("ac_input_frequency", 7, RegisterType.INT16, scale=100),
            RegisterDefinition("ac_input_power", 8, RegisterType.INT16),
            RegisterDefinition("ac_output_voltage", 12, scale=10),
            RegisterDefinition("ac_output_current", 13, RegisterType.INT16, scale=10),
            RegisterDefinition("ac_output_frequency", 14, RegisterType.INT16, scale=100),
            RegisterDefinition("ac_output_power", 15, RegisterType.INT16),
            RegisterDefinition("battery_voltage", 26, scale=100),
            RegisterDefinition("battery_current", 27, RegisterType.INT16, scale=10),
            RegisterDefinition("battery_temperature", 30, RegisterType.INT16, scale=10),
            RegisterDefinition("battery_soc", 31, scale=10),
            RegisterDefinition("vebus_state", 32),
            RegisterDefinition("dc_power", 33, RegisterType.INT16),
        )
