# Path: cbus/common.py
# class ExtendedCALType(IntEnum):
#     BINARY = 0x00
#     LEVEL = 0x07
# 
# class GroupState(IntEnum):
#     MISSING = 0x00
#     ON = 0x01
#     OFF = 0x02
#     ERROR = 0x03


import abc
from dataclasses import dataclass
from typing import Iterator, Optional, Sequence
from cbus.common import ExtendedCALType, GroupState
    @abc.abstractmethod
    def block_type(self) -> ExtendedCALType:
        raise NotImplementedError('block_type')

    @abc.abstractmethod
    def encode(self) -> bytes:
        raise NotImplementedError('encode')


@dataclass
class BinaryStatusReport(StatusReport, Sequence[GroupState]):
    _group_states: Sequence[GroupState]

    def __getitem__(self, i: int) -> GroupState:
        return self._group_states[i]

    def __len__(self) -> int:
        return len(self._group_states)

    def __iter__(self) -> Iterator[GroupState]:
        return iter(self._group_states)

    @classmethod
    def decode(cls, data: bytes) -> BinaryStatusReport:
        states = []
        for c in data:
            states += [
                GroupState(c & 0x3),
                GroupState((c >> 2) & 0x03),
                GroupState((c >> 4) & 0x03),

# Path: cbus/common.py
# class ExtendedCALType(IntEnum):
#     BINARY = 0x00
#     LEVEL = 0x07
# 
# class GroupState(IntEnum):
#     MISSING = 0x00
#     ON = 0x01
#     OFF = 0x02
#     ERROR = 0x03


# Path: cbus/protocol/cal/report.py
import abc
from dataclasses import dataclass
from typing import Iterator, Optional, Sequence
from cbus.common import ExtendedCALType, GroupState

    @abc.abstractmethod
    def block_type(self) -> ExtendedCALType:
        raise NotImplementedError('block_type')

    @abc.abstractmethod
    def encode(self) -> bytes:
        raise NotImplementedError('encode')


@dataclass
class BinaryStatusReport(StatusReport, Sequence[GroupState]):
    _group_states: Sequence[GroupState]

    def __getitem__(self, i: int) -> GroupState:
        return self._group_states[i]

    def __len__(self) -> int:
        return len(self._group_states)

    def __iter__(self) -> Iterator[GroupState]:
        return iter(self._group_states)

    @classmethod
    def decode(cls, data: bytes) -> BinaryStatusReport:
        states = []
        for c in data:
            states += [
                GroupState(c & 0x3),
                GroupState((c >> 2) & 0x03),
                GroupState((c >> 4) & 0x03),

                GroupState((c >> 6) & 0x03)]