# generated by scripts/generate_messages.py

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

class ObjGameDataTeam(PrettyPrint):
    def __init__(
            self,
            teamscore_red: int = 0,
            teamscore_blue: int = 0
    ) -> None:
        self.item_name: str = 'connless.game_data_team'
        self.type_id: int = 7
        self.id: int = 0
        self.size: int = 2

        self.teamscore_red: int = teamscore_red
        self.teamscore_blue: int = teamscore_blue

    # 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:
        self.teamscore_red = unpacker.get_int()
        self.teamscore_blue = unpacker.get_int()
        return True

    def pack(self) -> bytes:
        return pack_int(self.teamscore_red) + \
            pack_int(self.teamscore_blue)