from ...tl.mtproto_request import MTProtoRequest


class InputChatUploadedPhoto(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto"""

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

    def __init__(self, file):
        """
        :param file: Telegram type: "InputFile".

        Constructor for InputChatPhoto: Instance of either InputChatPhotoEmpty, InputChatUploadedPhoto, InputChatPhoto.
        """
        super().__init__()

        self.file = file

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

    def on_send(self, writer):
        writer.write_int(InputChatUploadedPhoto.constructor_id, signed=False)
        self.file.on_send(writer)

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

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

    def __repr__(self):
        return 'inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto'

    def __str__(self):
        return '(inputChatUploadedPhoto (ID: 0x927c55b4) = (file={}))'.format(str(self.file))
