from ...tl.tlobject import TLObject


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

    # Telegram's constructor (U)ID for this class
    constructor_id = 0x58fffcd0
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0xd32b1e35

    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 to_dict(self):
        return {
            'pos': self.pos,
            'user_id': self.user_id,
            'score': self.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 (attributes=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 TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
