from ...tl.mtproto_request import MTProtoRequest


class ChatForbidden(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    chatForbidden#07328bdb id:int title:string = Chat"""

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

    def __init__(self, id, title):
        """
        :param id: Telegram type: "int".
        :param title: Telegram type: "string".

        Constructor for Chat: Instance of either ChatEmpty, Chat, ChatForbidden, Channel, ChannelForbidden.
        """
        super().__init__()

        self.id = id
        self.title = title

    def to_dict(self):
        return {
            'id': self.id,
            'title': self.title,
        }

    def on_send(self, writer):
        writer.write_int(ChatForbidden.constructor_id, signed=False)
        writer.write_int(self.id)
        writer.tgwrite_string(self.title)

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

    def on_response(self, reader):
        self.id = reader.read_int()
        self.title = reader.tgread_string()

    def __repr__(self):
        return 'chatForbidden#07328bdb id:int title:string = Chat'

    def __str__(self):
        return '(chatForbidden (ID: 0x7328bdb) = (id={}, title={}))'.format(str(self.id), str(self.title))
