from ..message_base import MessageBase
from ..constants import Subaddress
from ..fields import BitField

class MsgReservedBase(MessageBase):
    """
    Base class for Reserved/Debug messages (B9, B10, B11).
    Exposes all 32 words as raw 16-bit fields.
    """
    IS_TRANSMIT = True
    
    # Define generic accessors for all 32 words
    word_01 = BitField(0, 0, 16)
    word_02 = BitField(1, 0, 16)
    word_03 = BitField(2, 0, 16)
    word_04 = BitField(3, 0, 16)
    word_05 = BitField(4, 0, 16)
    word_06 = BitField(5, 0, 16)
    word_07 = BitField(6, 0, 16)
    word_08 = BitField(7, 0, 16)
    word_09 = BitField(8, 0, 16)
    word_10 = BitField(9, 0, 16)
    word_11 = BitField(10, 0, 16)
    word_12 = BitField(11, 0, 16)
    word_13 = BitField(12, 0, 16)
    word_14 = BitField(13, 0, 16)
    word_15 = BitField(14, 0, 16)
    word_16 = BitField(15, 0, 16)
    word_17 = BitField(16, 0, 16)
    word_18 = BitField(17, 0, 16)
    word_19 = BitField(18, 0, 16)
    word_20 = BitField(19, 0, 16)
    word_21 = BitField(20, 0, 16)
    word_22 = BitField(21, 0, 16)
    word_23 = BitField(22, 0, 16)
    word_24 = BitField(23, 0, 16)
    word_25 = BitField(24, 0, 16)
    word_26 = BitField(25, 0, 16)
    word_27 = BitField(26, 0, 16)
    word_28 = BitField(27, 0, 16)
    word_29 = BitField(28, 0, 16)
    word_30 = BitField(29, 0, 16)
    word_31 = BitField(30, 0, 16)
    word_32 = BitField(31, 0, 16)


class MsgB9(MsgReservedBase):
    """
    Message B9: Reserved Message #1 (Search Target Message)
    ID: B9
    Subaddress: 19
    Rate: 50 Hz
    """
    SUBADDRESS = Subaddress.TX_RES_SEARCH


class MsgB10(MsgReservedBase):
    """
    Message B10: Reserved Message #2 (Mode Data Message)
    ID: B10
    Subaddress: 20
    Rate: 50 Hz
    """
    SUBADDRESS = Subaddress.TX_RES_MODE


class MsgB11(MsgReservedBase):
    """
    Message B11: Reserved TX Message (Debug Message)
    ID: B11
    Subaddress: 21
    Rate: 50 Hz
    """
    SUBADDRESS = Subaddress.TX_RES_DEBUG