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

// StickersChangeStickerPositionRequest represents TL type `stickers.changeStickerPosition#ffb6d4ca`.
// Changes the absolute position of a sticker in the set to which it belongs; for bots
// only. The sticker set must have been created by the bot
//
// See https://core.telegram.org/method/stickers.changeStickerPosition for reference.
type StickersChangeStickerPositionRequest struct {
	// The sticker
	Sticker InputDocumentClass
	// The new position of the sticker, zero-based
	Position int
}

// StickersChangeStickerPositionRequestTypeID is TL type id of StickersChangeStickerPositionRequest.
const StickersChangeStickerPositionRequestTypeID = 0xffb6d4ca

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

func ( *StickersChangeStickerPositionRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Sticker == nil) {
		return false
	}
	if !(.Position == 0) {
		return false
	}

	return true
}

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

// FillFrom fills StickersChangeStickerPositionRequest from given interface.
func ( *StickersChangeStickerPositionRequest) ( interface {
	() ( InputDocumentClass)
	() ( int)
}) {
	.Sticker = .()
	.Position = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StickersChangeStickerPositionRequest) () tdp.Type {
	 := tdp.Type{
		Name: "stickers.changeStickerPosition",
		ID:   StickersChangeStickerPositionRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Sticker",
			SchemaName: "sticker",
		},
		{
			Name:       "Position",
			SchemaName: "position",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StickersChangeStickerPositionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickers.changeStickerPosition#ffb6d4ca as nil")
	}
	.PutID(StickersChangeStickerPositionRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StickersChangeStickerPositionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode stickers.changeStickerPosition#ffb6d4ca as nil")
	}
	if .Sticker == nil {
		return fmt.Errorf("unable to encode stickers.changeStickerPosition#ffb6d4ca: field sticker is nil")
	}
	if  := .Sticker.Encode();  != nil {
		return fmt.Errorf("unable to encode stickers.changeStickerPosition#ffb6d4ca: field sticker: %w", )
	}
	.PutInt(.Position)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StickersChangeStickerPositionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode stickers.changeStickerPosition#ffb6d4ca to nil")
	}
	{
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.changeStickerPosition#ffb6d4ca: field sticker: %w", )
		}
		.Sticker = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode stickers.changeStickerPosition#ffb6d4ca: field position: %w", )
		}
		.Position = 
	}
	return nil
}

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

// GetPosition returns value of Position field.
func ( *StickersChangeStickerPositionRequest) () ( int) {
	if  == nil {
		return
	}
	return .Position
}

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

// StickersChangeStickerPosition invokes method stickers.changeStickerPosition#ffb6d4ca returning error if any.
// Changes the absolute position of a sticker in the set to which it belongs; for bots
// only. The sticker set must have been created by the bot
//
// Possible errors:
//
//	400 STICKER_INVALID: The provided sticker is invalid.
//
// See https://core.telegram.org/method/stickers.changeStickerPosition for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *StickersChangeStickerPositionRequest) (MessagesStickerSetClass, error) {
	var  MessagesStickerSetBox

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