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

// ChannelsSetStickersRequest represents TL type `channels.setStickers#ea8ca4f9`.
// Associate a stickerset to the supergroup
//
// See https://core.telegram.org/method/channels.setStickers for reference.
type ChannelsSetStickersRequest struct {
	// Supergroup
	Channel InputChannelClass
	// The stickerset to associate
	Stickerset InputStickerSetClass
}

// ChannelsSetStickersRequestTypeID is TL type id of ChannelsSetStickersRequest.
const ChannelsSetStickersRequestTypeID = 0xea8ca4f9

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

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

	return true
}

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

// FillFrom fills ChannelsSetStickersRequest from given interface.
func ( *ChannelsSetStickersRequest) ( interface {
	() ( InputChannelClass)
	() ( InputStickerSetClass)
}) {
	.Channel = .()
	.Stickerset = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ChannelsSetStickersRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.setStickers",
		ID:   ChannelsSetStickersRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
		{
			Name:       "Stickerset",
			SchemaName: "stickerset",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsSetStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.setStickers#ea8ca4f9 as nil")
	}
	.PutID(ChannelsSetStickersRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsSetStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.setStickers#ea8ca4f9 as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode channels.setStickers#ea8ca4f9: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.setStickers#ea8ca4f9: field channel: %w", )
	}
	if .Stickerset == nil {
		return fmt.Errorf("unable to encode channels.setStickers#ea8ca4f9: field stickerset is nil")
	}
	if  := .Stickerset.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.setStickers#ea8ca4f9: field stickerset: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsSetStickersRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.setStickers#ea8ca4f9 to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.setStickers#ea8ca4f9: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := DecodeInputStickerSet()
		if  != nil {
			return fmt.Errorf("unable to decode channels.setStickers#ea8ca4f9: field stickerset: %w", )
		}
		.Stickerset = 
	}
	return nil
}

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

// GetStickerset returns value of Stickerset field.
func ( *ChannelsSetStickersRequest) () ( InputStickerSetClass) {
	if  == nil {
		return
	}
	return .Stickerset
}

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

// ChannelsSetStickers invokes method channels.setStickers#ea8ca4f9 returning error if any.
// Associate a stickerset to the supergroup
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 PARTICIPANTS_TOO_FEW: Not enough participants.
//	406 STICKERSET_OWNER_ANONYMOUS: Provided stickerset can't be installed as group stickerset to prevent admin deanonymization.
//
// See https://core.telegram.org/method/channels.setStickers for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *ChannelsSetStickersRequest) (bool, error) {
	var  BoolBox

	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}