from ...tl.mtproto_request import MTProtoRequest


class ChannelAdminLogEventActionToggleInvites(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction"""

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

    def __init__(self, new_value):
        """
        :param new_value: Telegram type: "Bool".

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

        self.new_value = new_value

    def to_dict(self):
        return {
            'new_value': self.new_value,
        }

    def on_send(self, writer):
        writer.write_int(ChannelAdminLogEventActionToggleInvites.constructor_id, signed=False)
        writer.tgwrite_bool(self.new_value)

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

    def on_response(self, reader):
        self.new_value = reader.tgread_bool()

    def __repr__(self):
        return 'channelAdminLogEventActionToggleInvites#1b7907ae new_value:Bool = ChannelAdminLogEventAction'

    def __str__(self):
        return '(channelAdminLogEventActionToggleInvites (ID: 0x1b7907ae) = (new_value={}))'.format(str(self.new_value))
