from ....tl.mtproto_request import MTProtoRequest


class State(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    updates.state#a56c2a3e pts:int qts:int date:date seq:int unread_count:int = updates.State"""

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

    def __init__(self, pts, qts, date, seq, unread_count):
        """
        :param pts: Telegram type: «int».
        :param qts: Telegram type: «int».
        :param date: Telegram type: «date».
        :param seq: Telegram type: «int».
        :param unread_count: Telegram type: «int».

        Constructor for updates.State: Instance of State.
        """
        super().__init__()

        self.pts = pts
        self.qts = qts
        self.date = date
        self.seq = seq
        self.unread_count = unread_count

    def on_send(self, writer):
        writer.write_int(State.constructor_id, signed=False)
        writer.write_int(self.pts)
        writer.write_int(self.qts)
        writer.tgwrite_date(self.date)
        writer.write_int(self.seq)
        writer.write_int(self.unread_count)

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

    def on_response(self, reader):
        self.pts = reader.read_int()
        self.qts = reader.read_int()
        self.date = reader.tgread_date()
        self.seq = reader.read_int()
        self.unread_count = reader.read_int()

    def __repr__(self):
        return 'updates.state#a56c2a3e pts:int qts:int date:date seq:int unread_count:int = updates.State'

    def __str__(self):
        return '(updates.state (ID: 0xa56c2a3e) = (pts={}, qts={}, date={}, seq={}, unread_count={}))'.format(str(self.pts), str(self.qts), str(self.date), str(self.seq), str(self.unread_count))
