from ...tl.mtproto_request import MTProtoRequest


class HighScore(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    highScore#58fffcd0 pos:int user_id:int score:int = HighScore"""

    # Telegram's constructor ID (and unique identifier) for this class
    constructor_id = 0x58fffcd0

    def __init__(self, pos, user_id, score):
        """
        :param pos: Telegram type: «int».
        :param user_id: Telegram type: «int».
        :param score: Telegram type: «int».

        Constructor for HighScore: Instance of HighScore.
        """
        super().__init__()

        self.pos = pos
        self.user_id = user_id
        self.score = score

    def on_send(self, writer):
        writer.write_int(HighScore.constructor_id, signed=False)
        writer.write_int(self.pos)
        writer.write_int(self.user_id)
        writer.write_int(self.score)

    @staticmethod
    def empty():
        """Returns an "empty" instance (all attributes are None)"""
        return HighScore(None, None, None)

    def on_response(self, reader):
        self.pos = reader.read_int()
        self.user_id = reader.read_int()
        self.score = reader.read_int()

    def __repr__(self):
        return 'highScore#58fffcd0 pos:int user_id:int score:int = HighScore'

    def __str__(self):
        return '(highScore (ID: 0x58fffcd0) = (pos={}, user_id={}, score={}))'.format(str(self.pos), str(self.user_id), str(self.score))
