from ....tl.mtproto_request import MTProtoRequest


class GetContactsRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    contacts.getContacts#22c6aa08 hash:string = contacts.Contacts"""

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

    def __init__(self, hash):
        """
        :param hash: Telegram type: "string".

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

        self.hash = hash

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

    def on_send(self, writer):
        writer.write_int(GetContactsRequest.constructor_id, signed=False)
        writer.tgwrite_string(self.hash)

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

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

    def __repr__(self):
        return 'contacts.getContacts#22c6aa08 hash:string = contacts.Contacts'

    def __str__(self):
        return '(contacts.getContacts (ID: 0x22c6aa08) = (hash={}))'.format(str(self.hash))
