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

// ChannelsEditBannedRequest represents TL type `channels.editBanned#96e6cd81`.
// Ban/unban/kick a user in a supergroup/channelĀ¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/method/channels.editBanned for reference.
type ChannelsEditBannedRequest struct {
	// The supergroup/channelĀ¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	Channel InputChannelClass
	// Participant to ban
	Participant InputPeerClass
	// The banned rights
	BannedRights ChatBannedRights
}

// ChannelsEditBannedRequestTypeID is TL type id of ChannelsEditBannedRequest.
const ChannelsEditBannedRequestTypeID = 0x96e6cd81

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

func ( *ChannelsEditBannedRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Channel == nil) {
		return false
	}
	if !(.Participant == nil) {
		return false
	}
	if !(.BannedRights.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills ChannelsEditBannedRequest from given interface.
func ( *ChannelsEditBannedRequest) ( interface {
	() ( InputChannelClass)
	() ( InputPeerClass)
	() ( ChatBannedRights)
}) {
	.Channel = .()
	.Participant = .()
	.BannedRights = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ChannelsEditBannedRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.editBanned",
		ID:   ChannelsEditBannedRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
		{
			Name:       "Participant",
			SchemaName: "participant",
		},
		{
			Name:       "BannedRights",
			SchemaName: "banned_rights",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsEditBannedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.editBanned#96e6cd81 as nil")
	}
	.PutID(ChannelsEditBannedRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsEditBannedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.editBanned#96e6cd81 as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode channels.editBanned#96e6cd81: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.editBanned#96e6cd81: field channel: %w", )
	}
	if .Participant == nil {
		return fmt.Errorf("unable to encode channels.editBanned#96e6cd81: field participant is nil")
	}
	if  := .Participant.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.editBanned#96e6cd81: field participant: %w", )
	}
	if  := .BannedRights.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.editBanned#96e6cd81: field banned_rights: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *ChannelsEditBannedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.editBanned#96e6cd81 to nil")
	}
	if  := .ConsumeID(ChannelsEditBannedRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode channels.editBanned#96e6cd81: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsEditBannedRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.editBanned#96e6cd81 to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.editBanned#96e6cd81: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode channels.editBanned#96e6cd81: field participant: %w", )
		}
		.Participant = 
	}
	{
		if  := .BannedRights.Decode();  != nil {
			return fmt.Errorf("unable to decode channels.editBanned#96e6cd81: field banned_rights: %w", )
		}
	}
	return nil
}

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

// GetParticipant returns value of Participant field.
func ( *ChannelsEditBannedRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Participant
}

// GetBannedRights returns value of BannedRights field.
func ( *ChannelsEditBannedRequest) () ( ChatBannedRights) {
	if  == nil {
		return
	}
	return .BannedRights
}

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

// ChannelsEditBanned invokes method channels.editBanned#96e6cd81 returning error if any.
// Ban/unban/kick a user in a supergroup/channelĀ¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// Possible errors:
//
//	406 BANNED_RIGHTS_INVALID: You provided some invalid flags in the banned rights.
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	403 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 INPUT_USER_DEACTIVATED: The specified user was deleted.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PARTICIPANT_ID_INVALID: The specified participant ID is invalid.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 USER_ADMIN_INVALID: You're not an admin.
//	400 USER_ID_INVALID: The provided user ID is invalid.
//
// See https://core.telegram.org/method/channels.editBanned for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *ChannelsEditBannedRequest) (UpdatesClass, error) {
	var  UpdatesBox

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