from ....tl.mtproto_request import MTProtoRequest


class GetUserPhotosRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos"""

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

    def __init__(self, user_id, offset, max_id, limit):
        """
        :param user_id: Telegram type: «InputUser».
        :param offset: Telegram type: «int».
        :param max_id: Telegram type: «long».
        :param limit: Telegram type: «int».

        :returns photos.Photos: Instance of either Photos, PhotosSlice.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.user_id = user_id
        self.offset = offset
        self.max_id = max_id
        self.limit = limit

    def on_send(self, writer):
        writer.write_int(GetUserPhotosRequest.constructor_id, signed=False)
        self.user_id.on_send(writer)
        writer.write_int(self.offset)
        writer.write_long(self.max_id)
        writer.write_int(self.limit)

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

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

    def __repr__(self):
        return 'photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos'

    def __str__(self):
        return '(photos.getUserPhotos (ID: 0x91cd32a8) = (user_id={}, offset={}, max_id={}, limit={}))'.format(str(self.user_id), str(self.offset), str(self.max_id), str(self.limit))
