from telethon.tl.mtproto_request import MTProtoRequest


class ChatInviteAlready(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    chatInviteAlready#5a686d7c chat:Chat = ChatInvite"""

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

    def __init__(self, chat):
        """
        :param chat: Telegram type: «Chat».
        """
        super().__init__()

        self.chat = chat

    def on_send(self, writer):
        writer.write_int(ChatInviteAlready.constructor_id, signed=False)
        self.chat.on_send(writer)

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

    def on_response(self, reader):
        self.chat = reader.tgread_object()

    def __repr__(self):
        return 'chatInviteAlready#5a686d7c chat:Chat = ChatInvite'

    def __str__(self):
        return '(chatInviteAlready (ID: 0x5a686d7c) = (chat={}))'.format(str(self.chat))
