from ....tl.mtproto_request import MTProtoRequest


class GetUsersRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User>"""

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

    def __init__(self, id):
        """
        :param id: Telegram type: «InputUser». Must be a list.

        :returns Vector<User>: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.id = id

    def on_send(self, writer):
        writer.write_int(GetUsersRequest.constructor_id, signed=False)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.id))
        for id_item in self.id:
            id_item.on_send(writer)

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

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

    def __repr__(self):
        return 'users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User>'

    def __str__(self):
        return '(users.getUsers (ID: 0xd91a548) = (id={}))'.format(None if not self.id else [str(_) for _ in self.id])
