from ....tl.mtproto_request import MTProtoRequest


class DeleteContactRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    contacts.deleteContact#8e953744 id:InputUser = contacts.Link"""

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

    def __init__(self, id):
        """
        :param id: Telegram type: "InputUser".

        :returns contacts.Link: Instance of Link.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.id = id

    def to_dict(self):
        return {
            'id': None if self.id is None else self.id.to_dict(),
        }

    def on_send(self, writer):
        writer.write_int(DeleteContactRequest.constructor_id, signed=False)
        self.id.on_send(writer)

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

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

    def __repr__(self):
        return 'contacts.deleteContact#8e953744 id:InputUser = contacts.Link'

    def __str__(self):
        return '(contacts.deleteContact (ID: 0x8e953744) = (id={}))'.format(str(self.id))
