// Code generated by gotdgen, DO NOT EDIT.

package tdapi

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)

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

// StickerFullTypeRegular represents TL type `stickerFullTypeRegular#88685ef7`.
type StickerFullTypeRegular struct {
	// Premium animation of the sticker; may be null. If present, only Telegram Premium users
	// can use the sticker
	PremiumAnimation File
}

// StickerFullTypeRegularTypeID is TL type id of StickerFullTypeRegular.
const StickerFullTypeRegularTypeID = 0x88685ef7

// construct implements constructor of StickerFullTypeClass.
func (s StickerFullTypeRegular) construct() StickerFullTypeClass { return &s }

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

	_ StickerFullTypeClass = &StickerFullTypeRegular{}
)

func (s *StickerFullTypeRegular) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.PremiumAnimation.Zero()) {
		return false
	}

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*StickerFullTypeRegular) TypeName() string {
	return "stickerFullTypeRegular"
}

// TypeInfo returns info about TL type.
func (s *StickerFullTypeRegular) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "stickerFullTypeRegular",
		ID:   StickerFullTypeRegularTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "PremiumAnimation",
			SchemaName: "premium_animation",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *StickerFullTypeRegular) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeRegular#88685ef7 as nil")
	}
	b.PutID(StickerFullTypeRegularTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *StickerFullTypeRegular) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeRegular#88685ef7 as nil")
	}
	if err := s.PremiumAnimation.Encode(b); err != nil {
		return fmt.Errorf("unable to encode stickerFullTypeRegular#88685ef7: field premium_animation: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *StickerFullTypeRegular) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeRegular#88685ef7 to nil")
	}
	if err := b.ConsumeID(StickerFullTypeRegularTypeID); err != nil {
		return fmt.Errorf("unable to decode stickerFullTypeRegular#88685ef7: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *StickerFullTypeRegular) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeRegular#88685ef7 to nil")
	}
	{
		if err := s.PremiumAnimation.Decode(b); err != nil {
			return fmt.Errorf("unable to decode stickerFullTypeRegular#88685ef7: field premium_animation: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *StickerFullTypeRegular) EncodeTDLibJSON(b tdjson.Encoder) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeRegular#88685ef7 as nil")
	}
	b.ObjStart()
	b.PutID("stickerFullTypeRegular")
	b.Comma()
	b.FieldStart("premium_animation")
	if err := s.PremiumAnimation.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode stickerFullTypeRegular#88685ef7: field premium_animation: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *StickerFullTypeRegular) DecodeTDLibJSON(b tdjson.Decoder) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeRegular#88685ef7 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("stickerFullTypeRegular"); err != nil {
				return fmt.Errorf("unable to decode stickerFullTypeRegular#88685ef7: %w", err)
			}
		case "premium_animation":
			if err := s.PremiumAnimation.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode stickerFullTypeRegular#88685ef7: field premium_animation: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetPremiumAnimation returns value of PremiumAnimation field.
func (s *StickerFullTypeRegular) GetPremiumAnimation() (value File) {
	if s == nil {
		return
	}
	return s.PremiumAnimation
}

// StickerFullTypeMask represents TL type `stickerFullTypeMask#26dfbf37`.
type StickerFullTypeMask struct {
	// Position where the mask is placed; may be null
	MaskPosition MaskPosition
}

// StickerFullTypeMaskTypeID is TL type id of StickerFullTypeMask.
const StickerFullTypeMaskTypeID = 0x26dfbf37

// construct implements constructor of StickerFullTypeClass.
func (s StickerFullTypeMask) construct() StickerFullTypeClass { return &s }

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

	_ StickerFullTypeClass = &StickerFullTypeMask{}
)

func (s *StickerFullTypeMask) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.MaskPosition.Zero()) {
		return false
	}

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*StickerFullTypeMask) TypeName() string {
	return "stickerFullTypeMask"
}

// TypeInfo returns info about TL type.
func (s *StickerFullTypeMask) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "stickerFullTypeMask",
		ID:   StickerFullTypeMaskTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "MaskPosition",
			SchemaName: "mask_position",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *StickerFullTypeMask) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeMask#26dfbf37 as nil")
	}
	b.PutID(StickerFullTypeMaskTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *StickerFullTypeMask) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeMask#26dfbf37 as nil")
	}
	if err := s.MaskPosition.Encode(b); err != nil {
		return fmt.Errorf("unable to encode stickerFullTypeMask#26dfbf37: field mask_position: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *StickerFullTypeMask) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeMask#26dfbf37 to nil")
	}
	if err := b.ConsumeID(StickerFullTypeMaskTypeID); err != nil {
		return fmt.Errorf("unable to decode stickerFullTypeMask#26dfbf37: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *StickerFullTypeMask) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeMask#26dfbf37 to nil")
	}
	{
		if err := s.MaskPosition.Decode(b); err != nil {
			return fmt.Errorf("unable to decode stickerFullTypeMask#26dfbf37: field mask_position: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *StickerFullTypeMask) EncodeTDLibJSON(b tdjson.Encoder) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeMask#26dfbf37 as nil")
	}
	b.ObjStart()
	b.PutID("stickerFullTypeMask")
	b.Comma()
	b.FieldStart("mask_position")
	if err := s.MaskPosition.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode stickerFullTypeMask#26dfbf37: field mask_position: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *StickerFullTypeMask) DecodeTDLibJSON(b tdjson.Decoder) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeMask#26dfbf37 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("stickerFullTypeMask"); err != nil {
				return fmt.Errorf("unable to decode stickerFullTypeMask#26dfbf37: %w", err)
			}
		case "mask_position":
			if err := s.MaskPosition.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode stickerFullTypeMask#26dfbf37: field mask_position: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetMaskPosition returns value of MaskPosition field.
func (s *StickerFullTypeMask) GetMaskPosition() (value MaskPosition) {
	if s == nil {
		return
	}
	return s.MaskPosition
}

// StickerFullTypeCustomEmoji represents TL type `stickerFullTypeCustomEmoji#c37f05ab`.
type StickerFullTypeCustomEmoji struct {
	// Identifier of the custom emoji
	CustomEmojiID int64
	// True, if the sticker must be repainted to a text color in messages, the color of the
	// Telegram Premium badge in emoji status, white color on chat photos, or another
	// appropriate color in other places
	NeedsRepainting bool
}

// StickerFullTypeCustomEmojiTypeID is TL type id of StickerFullTypeCustomEmoji.
const StickerFullTypeCustomEmojiTypeID = 0xc37f05ab

// construct implements constructor of StickerFullTypeClass.
func (s StickerFullTypeCustomEmoji) construct() StickerFullTypeClass { return &s }

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

	_ StickerFullTypeClass = &StickerFullTypeCustomEmoji{}
)

func (s *StickerFullTypeCustomEmoji) Zero() bool {
	if s == nil {
		return true
	}
	if !(s.CustomEmojiID == 0) {
		return false
	}
	if !(s.NeedsRepainting == false) {
		return false
	}

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*StickerFullTypeCustomEmoji) TypeName() string {
	return "stickerFullTypeCustomEmoji"
}

// TypeInfo returns info about TL type.
func (s *StickerFullTypeCustomEmoji) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "stickerFullTypeCustomEmoji",
		ID:   StickerFullTypeCustomEmojiTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "CustomEmojiID",
			SchemaName: "custom_emoji_id",
		},
		{
			Name:       "NeedsRepainting",
			SchemaName: "needs_repainting",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (s *StickerFullTypeCustomEmoji) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeCustomEmoji#c37f05ab as nil")
	}
	b.PutID(StickerFullTypeCustomEmojiTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *StickerFullTypeCustomEmoji) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeCustomEmoji#c37f05ab as nil")
	}
	b.PutLong(s.CustomEmojiID)
	b.PutBool(s.NeedsRepainting)
	return nil
}

// Decode implements bin.Decoder.
func (s *StickerFullTypeCustomEmoji) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeCustomEmoji#c37f05ab to nil")
	}
	if err := b.ConsumeID(StickerFullTypeCustomEmojiTypeID); err != nil {
		return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *StickerFullTypeCustomEmoji) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeCustomEmoji#c37f05ab to nil")
	}
	{
		value, err := b.Long()
		if err != nil {
			return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: field custom_emoji_id: %w", err)
		}
		s.CustomEmojiID = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: field needs_repainting: %w", err)
		}
		s.NeedsRepainting = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (s *StickerFullTypeCustomEmoji) EncodeTDLibJSON(b tdjson.Encoder) error {
	if s == nil {
		return fmt.Errorf("can't encode stickerFullTypeCustomEmoji#c37f05ab as nil")
	}
	b.ObjStart()
	b.PutID("stickerFullTypeCustomEmoji")
	b.Comma()
	b.FieldStart("custom_emoji_id")
	b.PutLong(s.CustomEmojiID)
	b.Comma()
	b.FieldStart("needs_repainting")
	b.PutBool(s.NeedsRepainting)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (s *StickerFullTypeCustomEmoji) DecodeTDLibJSON(b tdjson.Decoder) error {
	if s == nil {
		return fmt.Errorf("can't decode stickerFullTypeCustomEmoji#c37f05ab to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("stickerFullTypeCustomEmoji"); err != nil {
				return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: %w", err)
			}
		case "custom_emoji_id":
			value, err := b.Long()
			if err != nil {
				return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: field custom_emoji_id: %w", err)
			}
			s.CustomEmojiID = value
		case "needs_repainting":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: field needs_repainting: %w", err)
			}
			s.NeedsRepainting = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetCustomEmojiID returns value of CustomEmojiID field.
func (s *StickerFullTypeCustomEmoji) GetCustomEmojiID() (value int64) {
	if s == nil {
		return
	}
	return s.CustomEmojiID
}

// GetNeedsRepainting returns value of NeedsRepainting field.
func (s *StickerFullTypeCustomEmoji) GetNeedsRepainting() (value bool) {
	if s == nil {
		return
	}
	return s.NeedsRepainting
}

// StickerFullTypeClassName is schema name of StickerFullTypeClass.
const StickerFullTypeClassName = "StickerFullType"

// StickerFullTypeClass represents StickerFullType generic type.
//
// Example:
//
//	g, err := tdapi.DecodeStickerFullType(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tdapi.StickerFullTypeRegular: // stickerFullTypeRegular#88685ef7
//	case *tdapi.StickerFullTypeMask: // stickerFullTypeMask#26dfbf37
//	case *tdapi.StickerFullTypeCustomEmoji: // stickerFullTypeCustomEmoji#c37f05ab
//	default: panic(v)
//	}
type StickerFullTypeClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() StickerFullTypeClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool

	EncodeTDLibJSON(b tdjson.Encoder) error
	DecodeTDLibJSON(b tdjson.Decoder) error
}

// DecodeStickerFullType implements binary de-serialization for StickerFullTypeClass.
func DecodeStickerFullType(buf *bin.Buffer) (StickerFullTypeClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case StickerFullTypeRegularTypeID:
		// Decoding stickerFullTypeRegular#88685ef7.
		v := StickerFullTypeRegular{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err)
		}
		return &v, nil
	case StickerFullTypeMaskTypeID:
		// Decoding stickerFullTypeMask#26dfbf37.
		v := StickerFullTypeMask{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err)
		}
		return &v, nil
	case StickerFullTypeCustomEmojiTypeID:
		// Decoding stickerFullTypeCustomEmoji#c37f05ab.
		v := StickerFullTypeCustomEmoji{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", bin.NewUnexpectedID(id))
	}
}

// DecodeTDLibJSONStickerFullType implements binary de-serialization for StickerFullTypeClass.
func DecodeTDLibJSONStickerFullType(buf tdjson.Decoder) (StickerFullTypeClass, error) {
	id, err := buf.FindTypeID()
	if err != nil {
		return nil, err
	}
	switch id {
	case "stickerFullTypeRegular":
		// Decoding stickerFullTypeRegular#88685ef7.
		v := StickerFullTypeRegular{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err)
		}
		return &v, nil
	case "stickerFullTypeMask":
		// Decoding stickerFullTypeMask#26dfbf37.
		v := StickerFullTypeMask{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err)
		}
		return &v, nil
	case "stickerFullTypeCustomEmoji":
		// Decoding stickerFullTypeCustomEmoji#c37f05ab.
		v := StickerFullTypeCustomEmoji{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", tdjson.NewUnexpectedID(id))
	}
}

// StickerFullType boxes the StickerFullTypeClass providing a helper.
type StickerFullTypeBox struct {
	StickerFullType StickerFullTypeClass
}

// Decode implements bin.Decoder for StickerFullTypeBox.
func (b *StickerFullTypeBox) Decode(buf *bin.Buffer) error {
	if b == nil {
		return fmt.Errorf("unable to decode StickerFullTypeBox to nil")
	}
	v, err := DecodeStickerFullType(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.StickerFullType = v
	return nil
}

// Encode implements bin.Encode for StickerFullTypeBox.
func (b *StickerFullTypeBox) Encode(buf *bin.Buffer) error {
	if b == nil || b.StickerFullType == nil {
		return fmt.Errorf("unable to encode StickerFullTypeClass as nil")
	}
	return b.StickerFullType.Encode(buf)
}

// DecodeTDLibJSON implements bin.Decoder for StickerFullTypeBox.
func (b *StickerFullTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
	if b == nil {
		return fmt.Errorf("unable to decode StickerFullTypeBox to nil")
	}
	v, err := DecodeTDLibJSONStickerFullType(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.StickerFullType = v
	return nil
}

// EncodeTDLibJSON implements bin.Encode for StickerFullTypeBox.
func (b *StickerFullTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
	if b == nil || b.StickerFullType == nil {
		return fmt.Errorf("unable to encode StickerFullTypeClass as nil")
	}
	return b.StickerFullType.EncodeTDLibJSON(buf)
}
