from .base_payload import MqttPayload
from .esp import (
    OTAResultPayload,
    OTAPayload,
    InitialDiagnosticsPayload,
    DiagnosticsPayload
)


class PowerPayload(MqttPayload):
    FORMAT = '=12sB'
    PACKER = {
        'state': lambda n: int(n),
        'secret': lambda s: s.encode('utf-8')
    }
    UNPACKER = {
        'state': lambda n: bool(n),
        'secret': lambda s: s.decode('utf-8')
    }

    secret: str
    state: bool
