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

// StickersChangeStickerRequest represents TL type `stickers.changeSticker#f5537ebc`.
// Update the keywords, emojis or mask coordinates¹ of a sticker, bots only.
//
// Links:
//  1. https://core.telegram.org/api/stickers#mask-stickers
//
// See https://core.telegram.org/method/stickers.changeSticker for reference.
type StickersChangeStickerRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// The sticker
	Sticker InputDocumentClass
	// If set, updates the emoji list associated to the sticker
	//
	// Use SetEmoji and GetEmoji helpers.
	Emoji string
	// If set, updates the mask coordinates¹
	//
	// Links:
	//  1) https://core.telegram.org/api/stickers#mask-stickers
	//
	// Use SetMaskCoords and GetMaskCoords helpers.
	MaskCoords MaskCoords
	// If set, updates the sticker keywords (separated by commas). Can't be provided for mask
	// stickers.
	//
	// Use SetKeywords and GetKeywords helpers.
	Keywords string
}

// StickersChangeStickerRequestTypeID is TL type id of StickersChangeStickerRequest.
const StickersChangeStickerRequestTypeID = 0xf5537ebc

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

func ( *StickersChangeStickerRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Sticker == nil) {
		return false
	}
	if !(.Emoji == "") {
		return false
	}
	if !(.MaskCoords.Zero()) {
		return false
	}
	if !(.Keywords == "") {
		return false
	}

	return true
}

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

// FillFrom fills StickersChangeStickerRequest from given interface.
func ( *StickersChangeStickerRequest) ( interface {
	() ( InputDocumentClass)
	() ( string,  bool)
	() ( MaskCoords,  bool)
	() ( string,  bool)
}) {
	.Sticker = .()
	if ,  := .();  {
		.Emoji = 
	}

	if ,  := .();  {
		.MaskCoords = 
	}

	if ,  := .();  {
		.Keywords = 
	}

}

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

// TypeName returns name of type in TL schema.
func (*StickersChangeStickerRequest) () string {
	return "stickers.changeSticker"
}

// TypeInfo returns info about TL type.
func ( *StickersChangeStickerRequest) () tdp.Type {
	 := tdp.Type{
		Name: "stickers.changeSticker",
		ID:   StickersChangeStickerRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Sticker",
			SchemaName: "sticker",
		},
		{
			Name:       "Emoji",
			SchemaName: "emoji",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "MaskCoords",
			SchemaName: "mask_coords",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Keywords",
			SchemaName: "keywords",
			Null:       !.Flags.Has(2),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *StickersChangeStickerRequest) () {
	if !(.Emoji == "") {
		.Flags.Set(0)
	}
	if !(.MaskCoords.Zero()) {
		.Flags.Set(1)
	}
	if !(.Keywords == "") {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *StickersChangeStickerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickers.changeSticker#f5537ebc as nil")
	}
	.PutID(StickersChangeStickerRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StickersChangeStickerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickers.changeSticker#f5537ebc as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode stickers.changeSticker#f5537ebc: field flags: %w", )
	}
	if .Sticker == nil {
		return fmt.Errorf("unable to encode stickers.changeSticker#f5537ebc: field sticker is nil")
	}
	if  := .Sticker.Encode();  != nil {
		return fmt.Errorf("unable to encode stickers.changeSticker#f5537ebc: field sticker: %w", )
	}
	if .Flags.Has(0) {
		.PutString(.Emoji)
	}
	if .Flags.Has(1) {
		if  := .MaskCoords.Encode();  != nil {
			return fmt.Errorf("unable to encode stickers.changeSticker#f5537ebc: field mask_coords: %w", )
		}
	}
	if .Flags.Has(2) {
		.PutString(.Keywords)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StickersChangeStickerRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickers.changeSticker#f5537ebc to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode stickers.changeSticker#f5537ebc: field flags: %w", )
		}
	}
	{
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.changeSticker#f5537ebc: field sticker: %w", )
		}
		.Sticker = 
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.changeSticker#f5537ebc: field emoji: %w", )
		}
		.Emoji = 
	}
	if .Flags.Has(1) {
		if  := .MaskCoords.Decode();  != nil {
			return fmt.Errorf("unable to decode stickers.changeSticker#f5537ebc: field mask_coords: %w", )
		}
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.changeSticker#f5537ebc: field keywords: %w", )
		}
		.Keywords = 
	}
	return nil
}

// GetSticker returns value of Sticker field.
func ( *StickersChangeStickerRequest) () ( InputDocumentClass) {
	if  == nil {
		return
	}
	return .Sticker
}

// SetEmoji sets value of Emoji conditional field.
func ( *StickersChangeStickerRequest) ( string) {
	.Flags.Set(0)
	.Emoji = 
}

// GetEmoji returns value of Emoji conditional field and
// boolean which is true if field was set.
func ( *StickersChangeStickerRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Emoji, true
}

// SetMaskCoords sets value of MaskCoords conditional field.
func ( *StickersChangeStickerRequest) ( MaskCoords) {
	.Flags.Set(1)
	.MaskCoords = 
}

// GetMaskCoords returns value of MaskCoords conditional field and
// boolean which is true if field was set.
func ( *StickersChangeStickerRequest) () ( MaskCoords,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .MaskCoords, true
}

// SetKeywords sets value of Keywords conditional field.
func ( *StickersChangeStickerRequest) ( string) {
	.Flags.Set(2)
	.Keywords = 
}

// GetKeywords returns value of Keywords conditional field and
// boolean which is true if field was set.
func ( *StickersChangeStickerRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Keywords, true
}

// GetStickerAsNotEmpty returns mapped value of Sticker field.
func ( *StickersChangeStickerRequest) () (*InputDocument, bool) {
	return .Sticker.AsNotEmpty()
}

// StickersChangeSticker invokes method stickers.changeSticker#f5537ebc returning error if any.
// Update the keywords, emojis or mask coordinates¹ of a sticker, bots only.
//
// Links:
//  1. https://core.telegram.org/api/stickers#mask-stickers
//
// Possible errors:
//
//	400 BOT_MISSING: Only bots can call this method, please use @stickers if you're a user.
//	400 STICKER_INVALID: The provided sticker is invalid.
//
// See https://core.telegram.org/method/stickers.changeSticker for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *StickersChangeStickerRequest) (MessagesStickerSetClass, error) {
	var  MessagesStickerSetBox

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