from ...tl.mtproto_request import MTProtoRequest


class ChannelAdminLogEventActionParticipantToggleBan(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction"""

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

    def __init__(self, prev_participant, new_participant):
        """
        :param prev_participant: Telegram type: "ChannelParticipant".
        :param new_participant: Telegram type: "ChannelParticipant".

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

        self.prev_participant = prev_participant
        self.new_participant = new_participant

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

    def on_send(self, writer):
        writer.write_int(ChannelAdminLogEventActionParticipantToggleBan.constructor_id, signed=False)
        self.prev_participant.on_send(writer)
        self.new_participant.on_send(writer)

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

    def on_response(self, reader):
        self.prev_participant = reader.tgread_object()
        self.new_participant = reader.tgread_object()

    def __repr__(self):
        return 'channelAdminLogEventActionParticipantToggleBan#e6d83d7e prev_participant:ChannelParticipant new_participant:ChannelParticipant = ChannelAdminLogEventAction'

    def __str__(self):
        return '(channelAdminLogEventActionParticipantToggleBan (ID: 0xe6d83d7e) = (prev_participant={}, new_participant={}))'.format(str(self.prev_participant), str(self.new_participant))
