from ...tl.mtproto_request import MTProtoRequest


class ChannelAdminLogEventActionChangePhoto(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction"""

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

    def __init__(self, prev_photo, new_photo):
        """
        :param prev_photo: Telegram type: "ChatPhoto".
        :param new_photo: Telegram type: "ChatPhoto".

        Constructor for ChannelAdminLogEventAction: Instance of either ChannelAdminLogEventActionChangeTitle, ChannelAdminLogEventActionChangeAbout, ChannelAdminLogEventActionChangeUsername, ChannelAdminLogEventActionChangePhoto, ChannelAdminLogEventActionToggleInvites, ChannelAdminLogEventActionToggleSignatures, ChannelAdminLogEventActionUpdatePinned, ChannelAdminLogEventActionEditMessage, ChannelAdminLogEventActionDeleteMessage, ChannelAdminLogEventActionParticipantJoin, ChannelAdminLogEventActionParticipantLeave, ChannelAdminLogEventActionParticipantInvite, ChannelAdminLogEventActionParticipantToggleBan, ChannelAdminLogEventActionParticipantToggleAdmin.
        """
        super().__init__()

        self.prev_photo = prev_photo
        self.new_photo = new_photo

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

    def on_send(self, writer):
        writer.write_int(ChannelAdminLogEventActionChangePhoto.constructor_id, signed=False)
        self.prev_photo.on_send(writer)
        self.new_photo.on_send(writer)

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

    def on_response(self, reader):
        self.prev_photo = reader.tgread_object()
        self.new_photo = reader.tgread_object()

    def __repr__(self):
        return 'channelAdminLogEventActionChangePhoto#b82f55c3 prev_photo:ChatPhoto new_photo:ChatPhoto = ChannelAdminLogEventAction'

    def __str__(self):
        return '(channelAdminLogEventActionChangePhoto (ID: 0xb82f55c3) = (prev_photo={}, new_photo={}))'.format(str(self.prev_photo), str(self.new_photo))
