// 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{}
)

// ChannelsToggleParticipantsHiddenRequest represents TL type `channels.toggleParticipantsHidden#6a6e7854`.
// Hide or display the participants list in a supergroup¹.
// The supergroup must have at least hidden_members_group_size_min participants in order
// to use this method, as specified by the client configuration parameters »¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//  2. https://core.telegram.org/api/config#client-configuration
//
// See https://core.telegram.org/method/channels.toggleParticipantsHidden for reference.
type ChannelsToggleParticipantsHiddenRequest struct {
	// Supergroup ID
	Channel InputChannelClass
	// If true, will hide the participants list; otherwise will unhide it.
	Enabled bool
}

// ChannelsToggleParticipantsHiddenRequestTypeID is TL type id of ChannelsToggleParticipantsHiddenRequest.
const ChannelsToggleParticipantsHiddenRequestTypeID = 0x6a6e7854

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

func ( *ChannelsToggleParticipantsHiddenRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Channel == nil) {
		return false
	}
	if !(.Enabled == false) {
		return false
	}

	return true
}

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

// FillFrom fills ChannelsToggleParticipantsHiddenRequest from given interface.
func ( *ChannelsToggleParticipantsHiddenRequest) ( interface {
	() ( InputChannelClass)
	() ( bool)
}) {
	.Channel = .()
	.Enabled = .()
}

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

// TypeName returns name of type in TL schema.
func (*ChannelsToggleParticipantsHiddenRequest) () string {
	return "channels.toggleParticipantsHidden"
}

// TypeInfo returns info about TL type.
func ( *ChannelsToggleParticipantsHiddenRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.toggleParticipantsHidden",
		ID:   ChannelsToggleParticipantsHiddenRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
		{
			Name:       "Enabled",
			SchemaName: "enabled",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsToggleParticipantsHiddenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.toggleParticipantsHidden#6a6e7854 as nil")
	}
	.PutID(ChannelsToggleParticipantsHiddenRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsToggleParticipantsHiddenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.toggleParticipantsHidden#6a6e7854 as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode channels.toggleParticipantsHidden#6a6e7854: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.toggleParticipantsHidden#6a6e7854: field channel: %w", )
	}
	.PutBool(.Enabled)
	return nil
}

// Decode implements bin.Decoder.
func ( *ChannelsToggleParticipantsHiddenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.toggleParticipantsHidden#6a6e7854 to nil")
	}
	if  := .ConsumeID(ChannelsToggleParticipantsHiddenRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode channels.toggleParticipantsHidden#6a6e7854: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsToggleParticipantsHiddenRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.toggleParticipantsHidden#6a6e7854 to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.toggleParticipantsHidden#6a6e7854: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode channels.toggleParticipantsHidden#6a6e7854: field enabled: %w", )
		}
		.Enabled = 
	}
	return nil
}

// GetChannel returns value of Channel field.
func ( *ChannelsToggleParticipantsHiddenRequest) () ( InputChannelClass) {
	if  == nil {
		return
	}
	return .Channel
}

// GetEnabled returns value of Enabled field.
func ( *ChannelsToggleParticipantsHiddenRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Enabled
}

// GetChannelAsNotEmpty returns mapped value of Channel field.
func ( *ChannelsToggleParticipantsHiddenRequest) () (NotEmptyInputChannel, bool) {
	return .Channel.AsNotEmpty()
}

// ChannelsToggleParticipantsHidden invokes method channels.toggleParticipantsHidden#6a6e7854 returning error if any.
// Hide or display the participants list in a supergroup¹.
// The supergroup must have at least hidden_members_group_size_min participants in order
// to use this method, as specified by the client configuration parameters »¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//  2. https://core.telegram.org/api/config#client-configuration
//
// Possible errors:
//
//	400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information.
//	400 PARTICIPANTS_TOO_FEW: Not enough participants.
//
// See https://core.telegram.org/method/channels.toggleParticipantsHidden for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *ChannelsToggleParticipantsHiddenRequest) (UpdatesClass, error) {
	var  UpdatesBox

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .Updates, nil
}