from telethon.tl.mtproto_request import MTProtoRequest


class Contact(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    contact#f911c994 user_id:int mutual:Bool = Contact"""

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

    def __init__(self, user_id, mutual):
        """
        :param user_id: Telegram type: «int».
        :param mutual: Telegram type: «Bool».
        """
        super().__init__()

        self.user_id = user_id
        self.mutual = mutual

    def on_send(self, writer):
        writer.write_int(Contact.constructor_id, signed=False)
        writer.write_int(self.user_id)
        writer.tgwrite_bool(self.mutual)

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

    def on_response(self, reader):
        self.user_id = reader.read_int()
        self.mutual = reader.tgread_bool()

    def __repr__(self):
        return 'contact#f911c994 user_id:int mutual:Bool = Contact'

    def __str__(self):
        return '(contact (ID: 0xf911c994) = (user_id={}, mutual={}))'.format(str(self.user_id), str(self.mutual))
