from data_gateway_sdk.protocols.smpm.smpm_ul_device_water_meter_08b_daily import SmpmUlDeviceWaterMeter08BDailyData
from data_gateway_sdk.utils.buf_ref import BufRef


def test_smpm_ul_device_water_meter_08b_daily() -> None:
    case_serialized = bytes.fromhex("68e4eab106a33a78")
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=112323.3, direct_flow_volume_day_ago=3.5, event_battery_or_temperature_limits=True, temperature=23, event_magnet=False, event_continues_consumption=False, event_case_was_opened=False, event_system_error=False, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=False) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=112323.3, direct_flow_volume_day_ago=3.5, event_battery_or_temperature_limits=True, temperature=23, event_magnet=False, event_continues_consumption=False, event_case_was_opened=False, event_system_error=False, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=False))  # noqa: E501
    case_serialized = bytes.fromhex("680000000080ffff")  # overflow
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=0.0, event_battery_or_temperature_limits=True, temperature=92, event_magnet=True, event_continues_consumption=True, event_case_was_opened=True, event_system_error=True, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=True) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=0.0, event_battery_or_temperature_limits=True, event_case_was_opened=True, event_continues_consumption=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_magnet=True, event_no_resource=True, event_reset=True, event_sensor_error=True, event_system_error=True, temperature=92))  # noqa: E501
    case_serialized = bytes.fromhex("68000000008080ff")  # overflow
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=0.0, event_battery_or_temperature_limits=True, temperature=-35, event_magnet=True, event_continues_consumption=True, event_case_was_opened=True, event_system_error=True, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=True) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=0.0, event_battery_or_temperature_limits=True, event_case_was_opened=True, event_continues_consumption=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_magnet=True, event_no_resource=True, event_reset=True, event_sensor_error=True, event_system_error=True, temperature=-35))  # noqa: E501
    case_serialized = bytes.fromhex("6800000000ffffff")  # overflow
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=12.7, event_battery_or_temperature_limits=True, temperature=92, event_magnet=True, event_continues_consumption=True, event_case_was_opened=True, event_system_error=True, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=True) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=12.7, event_battery_or_temperature_limits=True, event_case_was_opened=True, event_continues_consumption=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_magnet=True, event_no_resource=True, event_reset=True, event_sensor_error=True, event_system_error=True, temperature=92))  # noqa: E501
    case_serialized = bytes.fromhex("6800000000ff80ff")  # overflow
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=12.7, event_battery_or_temperature_limits=True, temperature=-35, event_magnet=True, event_continues_consumption=True, event_case_was_opened=True, event_system_error=True, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=True) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=12.7, event_battery_or_temperature_limits=True, event_case_was_opened=True, event_continues_consumption=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_magnet=True, event_no_resource=True, event_reset=True, event_sensor_error=True, event_system_error=True, temperature=-35))  # noqa: E501
    case_serialized = bytes.fromhex("680000000080ffff")  # overflow
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=0.0, event_battery_or_temperature_limits=True, temperature=92, event_magnet=True, event_continues_consumption=True, event_case_was_opened=True, event_system_error=True, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=True) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=8589934.592, direct_flow_volume_day_ago=0.0, event_battery_or_temperature_limits=True, event_case_was_opened=True, event_continues_consumption=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_magnet=True, event_no_resource=True, event_reset=True, event_sensor_error=True, event_system_error=True, temperature=92))  # noqa: E501
    case_serialized = bytes.fromhex("68000000008080ff")  # overflow
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=0.0, event_battery_or_temperature_limits=True, temperature=-35, event_magnet=True, event_continues_consumption=True, event_case_was_opened=True, event_system_error=True, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=True) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=8589934.592, direct_flow_volume_day_ago=0.0, event_battery_or_temperature_limits=True, event_case_was_opened=True, event_continues_consumption=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_magnet=True, event_no_resource=True, event_reset=True, event_sensor_error=True, event_system_error=True, temperature=-35))  # noqa: E501
    case_serialized = bytes.fromhex("6800000000ffffff")  # overflow
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=12.7, event_battery_or_temperature_limits=True, temperature=92, event_magnet=True, event_continues_consumption=True, event_case_was_opened=True, event_system_error=True, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=True) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=8589934.592, direct_flow_volume_day_ago=12.7, event_battery_or_temperature_limits=True, event_case_was_opened=True, event_continues_consumption=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_magnet=True, event_no_resource=True, event_reset=True, event_sensor_error=True, event_system_error=True, temperature=92))  # noqa: E501
    case_serialized = bytes.fromhex("6800000000ff80ff")  # overflow
    assert SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=0.0, direct_flow_volume_day_ago=12.7, event_battery_or_temperature_limits=True, temperature=-35, event_magnet=True, event_continues_consumption=True, event_case_was_opened=True, event_system_error=True, event_reset=True, event_sensor_error=True, event_no_resource=True, event_flow_speed_is_over_limit=True, event_flow_reverse=True) == SmpmUlDeviceWaterMeter08BDailyData.parse(BufRef(case_serialized))  # noqa: E501
    assert case_serialized == SmpmUlDeviceWaterMeter08BDailyData.serialize(SmpmUlDeviceWaterMeter08BDailyData(direct_flow_volume=8589934.592, direct_flow_volume_day_ago=12.7, event_battery_or_temperature_limits=True, event_case_was_opened=True, event_continues_consumption=True, event_flow_reverse=True, event_flow_speed_is_over_limit=True, event_magnet=True, event_no_resource=True, event_reset=True, event_sensor_error=True, event_system_error=True, temperature=-35))  # noqa: E501
