// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// ChannelAdminLogEventsFilter represents TL type `channelAdminLogEventsFilter#ea107ae4`.
// Filter only certain admin log events
//
// See https://core.telegram.org/constructor/channelAdminLogEventsFilter for reference.
type ChannelAdminLogEventsFilter struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Join events¹, including joins using invite links² and join requests³.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantJoin
	//  2) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantJoinByInvite
	//  3) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantJoinByRequest
	Join bool
	// Leave events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantLeave
	Leave bool
	// Invite events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantInvite
	Invite bool
	// Ban events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantToggleBan
	Ban bool
	// Unban events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantToggleBan
	Unban bool
	// Kick events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantToggleBan
	Kick bool
	// Unkick events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantToggleBan
	Unkick bool
	// Admin promotion events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantToggleAdmin
	Promote bool
	// Admin demotion events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionParticipantToggleAdmin
	Demote bool
	// Info change events (when about¹, linked chat², location³, photo⁴, stickerset⁵,
	// title⁶ or username⁷, slowmode⁸, history TTL⁹ settings of a channel gets
	// modified)
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionChangeAbout
	//  2) https://core.telegram.org/constructor/channelAdminLogEventActionChangeLinkedChat
	//  3) https://core.telegram.org/constructor/channelAdminLogEventActionChangeLocation
	//  4) https://core.telegram.org/constructor/channelAdminLogEventActionChangePhoto
	//  5) https://core.telegram.org/constructor/channelAdminLogEventActionChangeStickerSet
	//  6) https://core.telegram.org/constructor/channelAdminLogEventActionChangeTitle
	//  7) https://core.telegram.org/constructor/channelAdminLogEventActionChangeUsername
	//  8) https://core.telegram.org/constructor/channelAdminLogEventActionToggleSlowMode
	//  9) https://core.telegram.org/constructor/channelAdminLogEventActionChangeHistoryTTL
	Info bool
	// Settings change events (invites¹, hidden prehistory², signatures³, default banned
	// rights⁴, forum toggle events⁵)
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionToggleInvites
	//  2) https://core.telegram.org/constructor/channelAdminLogEventActionTogglePreHistoryHidden
	//  3) https://core.telegram.org/constructor/channelAdminLogEventActionToggleSignatures
	//  4) https://core.telegram.org/constructor/channelAdminLogEventActionDefaultBannedRights
	//  5) https://core.telegram.org/constructor/channelAdminLogEventActionToggleForum
	Settings bool
	// Message pin events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionUpdatePinned
	Pinned bool
	// Message edit events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionEditMessage
	Edit bool
	// Message deletion events¹
	//
	// Links:
	//  1) https://core.telegram.org/constructor/channelAdminLogEventActionDeleteMessage
	Delete bool
	// Group call events
	GroupCall bool
	// Invite events
	Invites bool
	// A message was posted in a channel
	Send bool
	// Forum¹-related events
	//
	// Links:
	//  1) https://core.telegram.org/api/forum
	Forums bool
}

// ChannelAdminLogEventsFilterTypeID is TL type id of ChannelAdminLogEventsFilter.
const ChannelAdminLogEventsFilterTypeID = 0xea107ae4

// Ensuring interfaces in compile-time for ChannelAdminLogEventsFilter.
var (
	_ bin.Encoder     = &ChannelAdminLogEventsFilter{}
	_ bin.Decoder     = &ChannelAdminLogEventsFilter{}
	_ bin.BareEncoder = &ChannelAdminLogEventsFilter{}
	_ bin.BareDecoder = &ChannelAdminLogEventsFilter{}
)

func ( *ChannelAdminLogEventsFilter) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Join == false) {
		return false
	}
	if !(.Leave == false) {
		return false
	}
	if !(.Invite == false) {
		return false
	}
	if !(.Ban == false) {
		return false
	}
	if !(.Unban == false) {
		return false
	}
	if !(.Kick == false) {
		return false
	}
	if !(.Unkick == false) {
		return false
	}
	if !(.Promote == false) {
		return false
	}
	if !(.Demote == false) {
		return false
	}
	if !(.Info == false) {
		return false
	}
	if !(.Settings == false) {
		return false
	}
	if !(.Pinned == false) {
		return false
	}
	if !(.Edit == false) {
		return false
	}
	if !(.Delete == false) {
		return false
	}
	if !(.GroupCall == false) {
		return false
	}
	if !(.Invites == false) {
		return false
	}
	if !(.Send == false) {
		return false
	}
	if !(.Forums == false) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *ChannelAdminLogEventsFilter) () string {
	if  == nil {
		return "ChannelAdminLogEventsFilter(nil)"
	}
	type  ChannelAdminLogEventsFilter
	return fmt.Sprintf("ChannelAdminLogEventsFilter%+v", (*))
}

// FillFrom fills ChannelAdminLogEventsFilter from given interface.
func ( *ChannelAdminLogEventsFilter) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
}) {
	.Join = .()
	.Leave = .()
	.Invite = .()
	.Ban = .()
	.Unban = .()
	.Kick = .()
	.Unkick = .()
	.Promote = .()
	.Demote = .()
	.Info = .()
	.Settings = .()
	.Pinned = .()
	.Edit = .()
	.Delete = .()
	.GroupCall = .()
	.Invites = .()
	.Send = .()
	.Forums = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*ChannelAdminLogEventsFilter) () uint32 {
	return ChannelAdminLogEventsFilterTypeID
}

// TypeName returns name of type in TL schema.
func (*ChannelAdminLogEventsFilter) () string {
	return "channelAdminLogEventsFilter"
}

// TypeInfo returns info about TL type.
func ( *ChannelAdminLogEventsFilter) () tdp.Type {
	 := tdp.Type{
		Name: "channelAdminLogEventsFilter",
		ID:   ChannelAdminLogEventsFilterTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Join",
			SchemaName: "join",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Leave",
			SchemaName: "leave",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Invite",
			SchemaName: "invite",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Ban",
			SchemaName: "ban",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Unban",
			SchemaName: "unban",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Kick",
			SchemaName: "kick",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Unkick",
			SchemaName: "unkick",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "Promote",
			SchemaName: "promote",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "Demote",
			SchemaName: "demote",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "Info",
			SchemaName: "info",
			Null:       !.Flags.Has(9),
		},
		{
			Name:       "Settings",
			SchemaName: "settings",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "Pinned",
			SchemaName: "pinned",
			Null:       !.Flags.Has(11),
		},
		{
			Name:       "Edit",
			SchemaName: "edit",
			Null:       !.Flags.Has(12),
		},
		{
			Name:       "Delete",
			SchemaName: "delete",
			Null:       !.Flags.Has(13),
		},
		{
			Name:       "GroupCall",
			SchemaName: "group_call",
			Null:       !.Flags.Has(14),
		},
		{
			Name:       "Invites",
			SchemaName: "invites",
			Null:       !.Flags.Has(15),
		},
		{
			Name:       "Send",
			SchemaName: "send",
			Null:       !.Flags.Has(16),
		},
		{
			Name:       "Forums",
			SchemaName: "forums",
			Null:       !.Flags.Has(17),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *ChannelAdminLogEventsFilter) () {
	if !(.Join == false) {
		.Flags.Set(0)
	}
	if !(.Leave == false) {
		.Flags.Set(1)
	}
	if !(.Invite == false) {
		.Flags.Set(2)
	}
	if !(.Ban == false) {
		.Flags.Set(3)
	}
	if !(.Unban == false) {
		.Flags.Set(4)
	}
	if !(.Kick == false) {
		.Flags.Set(5)
	}
	if !(.Unkick == false) {
		.Flags.Set(6)
	}
	if !(.Promote == false) {
		.Flags.Set(7)
	}
	if !(.Demote == false) {
		.Flags.Set(8)
	}
	if !(.Info == false) {
		.Flags.Set(9)
	}
	if !(.Settings == false) {
		.Flags.Set(10)
	}
	if !(.Pinned == false) {
		.Flags.Set(11)
	}
	if !(.Edit == false) {
		.Flags.Set(12)
	}
	if !(.Delete == false) {
		.Flags.Set(13)
	}
	if !(.GroupCall == false) {
		.Flags.Set(14)
	}
	if !(.Invites == false) {
		.Flags.Set(15)
	}
	if !(.Send == false) {
		.Flags.Set(16)
	}
	if !(.Forums == false) {
		.Flags.Set(17)
	}
}

// Encode implements bin.Encoder.
func ( *ChannelAdminLogEventsFilter) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channelAdminLogEventsFilter#ea107ae4 as nil")
	}
	.PutID(ChannelAdminLogEventsFilterTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelAdminLogEventsFilter) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channelAdminLogEventsFilter#ea107ae4 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode channelAdminLogEventsFilter#ea107ae4: field flags: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *ChannelAdminLogEventsFilter) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channelAdminLogEventsFilter#ea107ae4 to nil")
	}
	if  := .ConsumeID(ChannelAdminLogEventsFilterTypeID);  != nil {
		return fmt.Errorf("unable to decode channelAdminLogEventsFilter#ea107ae4: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ChannelAdminLogEventsFilter) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channelAdminLogEventsFilter#ea107ae4 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode channelAdminLogEventsFilter#ea107ae4: field flags: %w", )
		}
	}
	.Join = .Flags.Has(0)
	.Leave = .Flags.Has(1)
	.Invite = .Flags.Has(2)
	.Ban = .Flags.Has(3)
	.Unban = .Flags.Has(4)
	.Kick = .Flags.Has(5)
	.Unkick = .Flags.Has(6)
	.Promote = .Flags.Has(7)
	.Demote = .Flags.Has(8)
	.Info = .Flags.Has(9)
	.Settings = .Flags.Has(10)
	.Pinned = .Flags.Has(11)
	.Edit = .Flags.Has(12)
	.Delete = .Flags.Has(13)
	.GroupCall = .Flags.Has(14)
	.Invites = .Flags.Has(15)
	.Send = .Flags.Has(16)
	.Forums = .Flags.Has(17)
	return nil
}

// SetJoin sets value of Join conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(0)
		.Join = true
	} else {
		.Flags.Unset(0)
		.Join = false
	}
}

// GetJoin returns value of Join conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetLeave sets value of Leave conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(1)
		.Leave = true
	} else {
		.Flags.Unset(1)
		.Leave = false
	}
}

// GetLeave returns value of Leave conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetInvite sets value of Invite conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(2)
		.Invite = true
	} else {
		.Flags.Unset(2)
		.Invite = false
	}
}

// GetInvite returns value of Invite conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// SetBan sets value of Ban conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(3)
		.Ban = true
	} else {
		.Flags.Unset(3)
		.Ban = false
	}
}

// GetBan returns value of Ban conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetUnban sets value of Unban conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(4)
		.Unban = true
	} else {
		.Flags.Unset(4)
		.Unban = false
	}
}

// GetUnban returns value of Unban conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(4)
}

// SetKick sets value of Kick conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(5)
		.Kick = true
	} else {
		.Flags.Unset(5)
		.Kick = false
	}
}

// GetKick returns value of Kick conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// SetUnkick sets value of Unkick conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(6)
		.Unkick = true
	} else {
		.Flags.Unset(6)
		.Unkick = false
	}
}

// GetUnkick returns value of Unkick conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(6)
}

// SetPromote sets value of Promote conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(7)
		.Promote = true
	} else {
		.Flags.Unset(7)
		.Promote = false
	}
}

// GetPromote returns value of Promote conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(7)
}

// SetDemote sets value of Demote conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(8)
		.Demote = true
	} else {
		.Flags.Unset(8)
		.Demote = false
	}
}

// GetDemote returns value of Demote conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(8)
}

// SetInfo sets value of Info conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(9)
		.Info = true
	} else {
		.Flags.Unset(9)
		.Info = false
	}
}

// GetInfo returns value of Info conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(9)
}

// SetSettings sets value of Settings conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(10)
		.Settings = true
	} else {
		.Flags.Unset(10)
		.Settings = false
	}
}

// GetSettings returns value of Settings conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(10)
}

// SetPinned sets value of Pinned conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(11)
		.Pinned = true
	} else {
		.Flags.Unset(11)
		.Pinned = false
	}
}

// GetPinned returns value of Pinned conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(11)
}

// SetEdit sets value of Edit conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(12)
		.Edit = true
	} else {
		.Flags.Unset(12)
		.Edit = false
	}
}

// GetEdit returns value of Edit conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(12)
}

// SetDelete sets value of Delete conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(13)
		.Delete = true
	} else {
		.Flags.Unset(13)
		.Delete = false
	}
}

// GetDelete returns value of Delete conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(13)
}

// SetGroupCall sets value of GroupCall conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(14)
		.GroupCall = true
	} else {
		.Flags.Unset(14)
		.GroupCall = false
	}
}

// GetGroupCall returns value of GroupCall conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(14)
}

// SetInvites sets value of Invites conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(15)
		.Invites = true
	} else {
		.Flags.Unset(15)
		.Invites = false
	}
}

// GetInvites returns value of Invites conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(15)
}

// SetSend sets value of Send conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(16)
		.Send = true
	} else {
		.Flags.Unset(16)
		.Send = false
	}
}

// GetSend returns value of Send conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(16)
}

// SetForums sets value of Forums conditional field.
func ( *ChannelAdminLogEventsFilter) ( bool) {
	if  {
		.Flags.Set(17)
		.Forums = true
	} else {
		.Flags.Unset(17)
		.Forums = false
	}
}

// GetForums returns value of Forums conditional field.
func ( *ChannelAdminLogEventsFilter) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(17)
}