"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
from typing import Optional, List, Union, TYPE_CHECKING
import os
import struct
if TYPE_CHECKING:
    from ...tl.types import TypeInputUser, TypeInputFile, TypeInputPhoto



class DeletePhotosRequest(TLObject):
    CONSTRUCTOR_ID = 0x87cf7f2f
    SUBCLASS_OF_ID = 0x8918e168

    def __init__(self, id):
        """
        :param List[TypeInputPhoto] id:

        :returns Vector<long>: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.id = id  # type: List[TypeInputPhoto]

    def resolve(self, client, utils):
        self.id = [utils.get_input_photo(_x) for _x in self.id]

    def to_dict(self):
        return {
            '_': 'DeletePhotosRequest',
            'id': [] if self.id is None else [None if x is None else x.to_dict() for x in self.id]
        }

    def __bytes__(self):
        return b''.join((
            b'/\x7f\xcf\x87',
            b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.id)),b''.join(bytes(x) for x in self.id),
        ))

    @classmethod
    def from_reader(cls, reader):
        reader.read_int()
        _id = []
        for _ in range(reader.read_int()):
            _x = reader.tgread_object()
            _id.append(_x)

        return cls(id=_id)

    def on_response(self, reader):
        reader.read_int()  # Vector ID
        self.result = [reader.read_long() for _ in range(reader.read_int())]


class GetUserPhotosRequest(TLObject):
    CONSTRUCTOR_ID = 0x91cd32a8
    SUBCLASS_OF_ID = 0x27cfb967

    def __init__(self, user_id, offset, max_id, limit):
        """
        :param TypeInputUser user_id:
        :param int offset:
        :param int max_id:
        :param int limit:

        :returns photos.Photos: Instance of either Photos, PhotosSlice.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.user_id = user_id  # type: TypeInputUser
        self.offset = offset  # type: int
        self.max_id = max_id  # type: int
        self.limit = limit  # type: int

    def resolve(self, client, utils):
        self.user_id = utils.get_input_user(client.get_input_entity(self.user_id))

    def to_dict(self):
        return {
            '_': 'GetUserPhotosRequest',
            'user_id': None if self.user_id is None else self.user_id.to_dict(),
            'offset': self.offset,
            'max_id': self.max_id,
            'limit': self.limit
        }

    def __bytes__(self):
        return b''.join((
            b'\xa82\xcd\x91',
            bytes(self.user_id),
            struct.pack('<i', self.offset),
            struct.pack('<q', self.max_id),
            struct.pack('<i', self.limit),
        ))

    @classmethod
    def from_reader(cls, reader):
        _user_id = reader.tgread_object()
        _offset = reader.read_int()
        _max_id = reader.read_long()
        _limit = reader.read_int()
        return cls(user_id=_user_id, offset=_offset, max_id=_max_id, limit=_limit)


class UpdateProfilePhotoRequest(TLObject):
    CONSTRUCTOR_ID = 0xf0bb5152
    SUBCLASS_OF_ID = 0xc6338f7d

    def __init__(self, id):
        """
        :param TypeInputPhoto id:

        :returns UserProfilePhoto: Instance of either UserProfilePhotoEmpty, UserProfilePhoto.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.id = id  # type: TypeInputPhoto

    def resolve(self, client, utils):
        self.id = utils.get_input_photo(self.id)

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

    def __bytes__(self):
        return b''.join((
            b'RQ\xbb\xf0',
            bytes(self.id),
        ))

    @classmethod
    def from_reader(cls, reader):
        _id = reader.tgread_object()
        return cls(id=_id)


class UploadProfilePhotoRequest(TLObject):
    CONSTRUCTOR_ID = 0x4f32c098
    SUBCLASS_OF_ID = 0xc292bd24

    def __init__(self, file):
        """
        :param TypeInputFile file:

        :returns photos.Photo: Instance of Photo.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.file = file  # type: TypeInputFile

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

    def __bytes__(self):
        return b''.join((
            b'\x98\xc02O',
            bytes(self.file),
        ))

    @classmethod
    def from_reader(cls, reader):
        _file = reader.tgread_object()
        return cls(file=_file)

