# generated by scripts/generate_messages.py

from typing import Any, Dict

from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.packer import pack_int
from typing import Annotated

class ObjDeTuneParams(PrettyPrint):
    def __init__(
            self,
            tune_params: Annotated[list[int], 32] = \
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    ) -> None:
        self.item_name: str = 'obj.de_tune_params'
        self.type_id: int = 15
        self.id: int = 0
        self.size: int = 1

        self.tune_params = tune_params

    def __iter__(self):
        yield 'item_name', self.item_name
        yield 'type_id', self.type_id
        yield 'id', self.id
        yield 'size', self.size

        yield 'tune_params', self.tune_params

    def to_dict_payload_only(self) -> Dict[str, Any]:
        return {
            'tune_params': self.tune_params
        }

    # first byte of data
    # has to be the first byte of the message payload
    # NOT the chunk header and NOT the message id
    def unpack(self, unpacker: Unpacker) -> bool:
        for i in range(0, 32):
            self.tune_params[i] = unpacker.get_int()
        return True

    def pack(self) -> bytes:
        return b''.join([pack_int(x) for x in self.tune_params])