# Path: beacontools/const.py
# CJ_TEMPHUM_TYPE = 0x10fe


from construct import Struct, Int8ul, Int16ul, Switch
from ..const import CJ_TEMPHUM_TYPE
"""All low level structures used for parsing control-j Monitor packets."""


# pylint: disable=invalid-name

CJMonitorTempHum = Struct(
    "temperature" / Int16ul,
    "humidity" / Int8ul,
    "light" / Int8ul,
)

CJMonitorMSD = Struct(
    "beacon_type" / Int16ul,
    "data" / Switch(lambda ctx: ctx.beacon_type, {

# Path: beacontools/const.py
# CJ_TEMPHUM_TYPE = 0x10fe


# Path: beacontools/structs/controlj.py
from construct import Struct, Int8ul, Int16ul, Switch
from ..const import CJ_TEMPHUM_TYPE

"""All low level structures used for parsing control-j Monitor packets."""


# pylint: disable=invalid-name

CJMonitorTempHum = Struct(
    "temperature" / Int16ul,
    "humidity" / Int8ul,
    "light" / Int8ul,
)

CJMonitorMSD = Struct(
    "beacon_type" / Int16ul,
    "data" / Switch(lambda ctx: ctx.beacon_type, {

        CJ_TEMPHUM_TYPE: CJMonitorTempHum,