from ...tl.mtproto_request import MTProtoRequest


class InputChatPhoto(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto"""

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

    def __init__(self, id):
        """
        :param id: Telegram type: "InputPhoto".

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

        self.id = id

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

    def on_send(self, writer):
        writer.write_int(InputChatPhoto.constructor_id, signed=False)
        self.id.on_send(writer)

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

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

    def __repr__(self):
        return 'inputChatPhoto#8953ad37 id:InputPhoto = InputChatPhoto'

    def __str__(self):
        return '(inputChatPhoto (ID: 0x8953ad37) = (id={}))'.format(str(self.id))
