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

// MessagesAllStickersNotModified represents TL type `messages.allStickersNotModified#e86602c3`.
// Info about all installed stickers hasn't changed
//
// See https://core.telegram.org/constructor/messages.allStickersNotModified for reference.
type MessagesAllStickersNotModified struct {
}

// MessagesAllStickersNotModifiedTypeID is TL type id of MessagesAllStickersNotModified.
const MessagesAllStickersNotModifiedTypeID = 0xe86602c3

// construct implements constructor of MessagesAllStickersClass.
func ( MessagesAllStickersNotModified) () MessagesAllStickersClass { return & }

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

	_ MessagesAllStickersClass = &MessagesAllStickersNotModified{}
)

func ( *MessagesAllStickersNotModified) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*MessagesAllStickersNotModified) () string {
	return "messages.allStickersNotModified"
}

// TypeInfo returns info about TL type.
func ( *MessagesAllStickersNotModified) () tdp.Type {
	 := tdp.Type{
		Name: "messages.allStickersNotModified",
		ID:   MessagesAllStickersNotModifiedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesAllStickersNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.allStickersNotModified#e86602c3 as nil")
	}
	.PutID(MessagesAllStickersNotModifiedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesAllStickersNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.allStickersNotModified#e86602c3 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesAllStickersNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.allStickersNotModified#e86602c3 to nil")
	}
	if  := .ConsumeID(MessagesAllStickersNotModifiedTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.allStickersNotModified#e86602c3: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesAllStickersNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.allStickersNotModified#e86602c3 to nil")
	}
	return nil
}

// MessagesAllStickers represents TL type `messages.allStickers#cdbbcebb`.
// Info about all installed stickers
//
// See https://core.telegram.org/constructor/messages.allStickers for reference.
type MessagesAllStickers struct {
	// Hash for pagination, for more info click hereĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
	// All stickersets
	Sets []StickerSet
}

// MessagesAllStickersTypeID is TL type id of MessagesAllStickers.
const MessagesAllStickersTypeID = 0xcdbbcebb

// construct implements constructor of MessagesAllStickersClass.
func ( MessagesAllStickers) () MessagesAllStickersClass { return & }

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

	_ MessagesAllStickersClass = &MessagesAllStickers{}
)

func ( *MessagesAllStickers) () bool {
	if  == nil {
		return true
	}
	if !(.Hash == 0) {
		return false
	}
	if !(.Sets == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesAllStickers from given interface.
func ( *MessagesAllStickers) ( interface {
	() ( int64)
	() ( []StickerSet)
}) {
	.Hash = .()
	.Sets = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesAllStickers) () string {
	return "messages.allStickers"
}

// TypeInfo returns info about TL type.
func ( *MessagesAllStickers) () tdp.Type {
	 := tdp.Type{
		Name: "messages.allStickers",
		ID:   MessagesAllStickersTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
		{
			Name:       "Sets",
			SchemaName: "sets",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesAllStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.allStickers#cdbbcebb as nil")
	}
	.PutID(MessagesAllStickersTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesAllStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.allStickers#cdbbcebb as nil")
	}
	.PutLong(.Hash)
	.PutVectorHeader(len(.Sets))
	for ,  := range .Sets {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.allStickers#cdbbcebb: field sets element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesAllStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.allStickers#cdbbcebb to nil")
	}
	if  := .ConsumeID(MessagesAllStickersTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.allStickers#cdbbcebb: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesAllStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.allStickers#cdbbcebb to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.allStickers#cdbbcebb: field hash: %w", )
		}
		.Hash = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.allStickers#cdbbcebb: field sets: %w", )
		}

		if  > 0 {
			.Sets = make([]StickerSet, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  StickerSet
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode messages.allStickers#cdbbcebb: field sets: %w", )
			}
			.Sets = append(.Sets, )
		}
	}
	return nil
}

// GetHash returns value of Hash field.
func ( *MessagesAllStickers) () ( int64) {
	if  == nil {
		return
	}
	return .Hash
}

// GetSets returns value of Sets field.
func ( *MessagesAllStickers) () ( []StickerSet) {
	if  == nil {
		return
	}
	return .Sets
}

// MessagesAllStickersClassName is schema name of MessagesAllStickersClass.
const MessagesAllStickersClassName = "messages.AllStickers"

// MessagesAllStickersClass represents messages.AllStickers generic type.
//
// See https://core.telegram.org/type/messages.AllStickers for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesAllStickers(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessagesAllStickersNotModified: // messages.allStickersNotModified#e86602c3
//	case *tg.MessagesAllStickers: // messages.allStickers#cdbbcebb
//	default: panic(v)
//	}
type MessagesAllStickersClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesAllStickersClass

	// 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

	// AsModified tries to map MessagesAllStickersClass to MessagesAllStickers.
	AsModified() (*MessagesAllStickers, bool)
}

// AsModified tries to map MessagesAllStickersNotModified to MessagesAllStickers.
func ( *MessagesAllStickersNotModified) () (*MessagesAllStickers, bool) {
	return nil, false
}

// AsModified tries to map MessagesAllStickers to MessagesAllStickers.
func ( *MessagesAllStickers) () (*MessagesAllStickers, bool) {
	return , true
}

// DecodeMessagesAllStickers implements binary de-serialization for MessagesAllStickersClass.
func ( *bin.Buffer) (MessagesAllStickersClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessagesAllStickersNotModifiedTypeID:
		// Decoding messages.allStickersNotModified#e86602c3.
		 := MessagesAllStickersNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesAllStickersClass: %w", )
		}
		return &, nil
	case MessagesAllStickersTypeID:
		// Decoding messages.allStickers#cdbbcebb.
		 := MessagesAllStickers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesAllStickersClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesAllStickersClass: %w", bin.NewUnexpectedID())
	}
}

// MessagesAllStickers boxes the MessagesAllStickersClass providing a helper.
type MessagesAllStickersBox struct {
	AllStickers MessagesAllStickersClass
}

// Decode implements bin.Decoder for MessagesAllStickersBox.
func ( *MessagesAllStickersBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode MessagesAllStickersBox to nil")
	}
	,  := DecodeMessagesAllStickers()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.AllStickers = 
	return nil
}

// Encode implements bin.Encode for MessagesAllStickersBox.
func ( *MessagesAllStickersBox) ( *bin.Buffer) error {
	if  == nil || .AllStickers == nil {
		return fmt.Errorf("unable to encode MessagesAllStickersClass as nil")
	}
	return .AllStickers.Encode()
}