from ....tl.mtproto_request import MTProtoRequest


class AffectedHistory(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory"""

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

    def __init__(self, pts, pts_count, offset):
        """
        :param pts: Telegram type: "int".
        :param pts_count: Telegram type: "int".
        :param offset: Telegram type: "int".

        Constructor for messages.AffectedHistory: Instance of AffectedHistory.
        """
        super().__init__()

        self.pts = pts
        self.pts_count = pts_count
        self.offset = offset

    def to_dict(self):
        return {
            'pts': self.pts,
            'pts_count': self.pts_count,
            'offset': self.offset,
        }

    def on_send(self, writer):
        writer.write_int(AffectedHistory.constructor_id, signed=False)
        writer.write_int(self.pts)
        writer.write_int(self.pts_count)
        writer.write_int(self.offset)

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return AffectedHistory(None, None, None)

    def on_response(self, reader):
        self.pts = reader.read_int()
        self.pts_count = reader.read_int()
        self.offset = reader.read_int()

    def __repr__(self):
        return 'messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory'

    def __str__(self):
        return '(messages.affectedHistory (ID: 0xb45c69d1) = (pts={}, pts_count={}, offset={}))'.format(str(self.pts), str(self.pts_count), str(self.offset))
