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

// MessagesFavedStickersNotModified represents TL type `messages.favedStickersNotModified#9e8fa6d3`.
// No new favorited stickers were found
//
// See https://core.telegram.org/constructor/messages.favedStickersNotModified for reference.
type MessagesFavedStickersNotModified struct {
}

// MessagesFavedStickersNotModifiedTypeID is TL type id of MessagesFavedStickersNotModified.
const MessagesFavedStickersNotModifiedTypeID = 0x9e8fa6d3

// construct implements constructor of MessagesFavedStickersClass.
func ( MessagesFavedStickersNotModified) () MessagesFavedStickersClass { return & }

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

	_ MessagesFavedStickersClass = &MessagesFavedStickersNotModified{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesFavedStickersNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.favedStickersNotModified#9e8fa6d3 as nil")
	}
	.PutID(MessagesFavedStickersNotModifiedTypeID)
	return .EncodeBare()
}

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

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

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

// MessagesFavedStickers represents TL type `messages.favedStickers#2cb51097`.
// Favorited stickers
//
// See https://core.telegram.org/constructor/messages.favedStickers for reference.
type MessagesFavedStickers struct {
	// Hash for pagination, for more info click hereĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
	// Emojis associated to stickers
	Packs []StickerPack
	// Favorited stickers
	Stickers []DocumentClass
}

// MessagesFavedStickersTypeID is TL type id of MessagesFavedStickers.
const MessagesFavedStickersTypeID = 0x2cb51097

// construct implements constructor of MessagesFavedStickersClass.
func ( MessagesFavedStickers) () MessagesFavedStickersClass { return & }

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

	_ MessagesFavedStickersClass = &MessagesFavedStickers{}
)

func ( *MessagesFavedStickers) () bool {
	if  == nil {
		return true
	}
	if !(.Hash == 0) {
		return false
	}
	if !(.Packs == nil) {
		return false
	}
	if !(.Stickers == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesFavedStickers from given interface.
func ( *MessagesFavedStickers) ( interface {
	() ( int64)
	() ( []StickerPack)
	() ( []DocumentClass)
}) {
	.Hash = .()
	.Packs = .()
	.Stickers = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesFavedStickers) () tdp.Type {
	 := tdp.Type{
		Name: "messages.favedStickers",
		ID:   MessagesFavedStickersTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
		{
			Name:       "Packs",
			SchemaName: "packs",
		},
		{
			Name:       "Stickers",
			SchemaName: "stickers",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesFavedStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.favedStickers#2cb51097 as nil")
	}
	.PutID(MessagesFavedStickersTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesFavedStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.favedStickers#2cb51097 as nil")
	}
	.PutLong(.Hash)
	.PutVectorHeader(len(.Packs))
	for ,  := range .Packs {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.favedStickers#2cb51097: field packs element with index %d: %w", , )
		}
	}
	.PutVectorHeader(len(.Stickers))
	for ,  := range .Stickers {
		if  == nil {
			return fmt.Errorf("unable to encode messages.favedStickers#2cb51097: field stickers element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.favedStickers#2cb51097: field stickers element with index %d: %w", , )
		}
	}
	return nil
}

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

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

		if  > 0 {
			.Packs = make([]StickerPack, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  StickerPack
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode messages.favedStickers#2cb51097: field packs: %w", )
			}
			.Packs = append(.Packs, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.favedStickers#2cb51097: field stickers: %w", )
		}

		if  > 0 {
			.Stickers = make([]DocumentClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeDocument()
			if  != nil {
				return fmt.Errorf("unable to decode messages.favedStickers#2cb51097: field stickers: %w", )
			}
			.Stickers = append(.Stickers, )
		}
	}
	return nil
}

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

// GetPacks returns value of Packs field.
func ( *MessagesFavedStickers) () ( []StickerPack) {
	if  == nil {
		return
	}
	return .Packs
}

// GetStickers returns value of Stickers field.
func ( *MessagesFavedStickers) () ( []DocumentClass) {
	if  == nil {
		return
	}
	return .Stickers
}

// MapStickers returns field Stickers wrapped in DocumentClassArray helper.
func ( *MessagesFavedStickers) () ( DocumentClassArray) {
	return DocumentClassArray(.Stickers)
}

// MessagesFavedStickersClassName is schema name of MessagesFavedStickersClass.
const MessagesFavedStickersClassName = "messages.FavedStickers"

// MessagesFavedStickersClass represents messages.FavedStickers generic type.
//
// See https://core.telegram.org/type/messages.FavedStickers for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesFavedStickers(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessagesFavedStickersNotModified: // messages.favedStickersNotModified#9e8fa6d3
//	case *tg.MessagesFavedStickers: // messages.favedStickers#2cb51097
//	default: panic(v)
//	}
type MessagesFavedStickersClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesFavedStickersClass

	// 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 MessagesFavedStickersClass to MessagesFavedStickers.
	AsModified() (*MessagesFavedStickers, bool)
}

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

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

// DecodeMessagesFavedStickers implements binary de-serialization for MessagesFavedStickersClass.
func ( *bin.Buffer) (MessagesFavedStickersClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessagesFavedStickersNotModifiedTypeID:
		// Decoding messages.favedStickersNotModified#9e8fa6d3.
		 := MessagesFavedStickersNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesFavedStickersClass: %w", )
		}
		return &, nil
	case MessagesFavedStickersTypeID:
		// Decoding messages.favedStickers#2cb51097.
		 := MessagesFavedStickers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesFavedStickersClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesFavedStickersClass: %w", bin.NewUnexpectedID())
	}
}

// MessagesFavedStickers boxes the MessagesFavedStickersClass providing a helper.
type MessagesFavedStickersBox struct {
	FavedStickers MessagesFavedStickersClass
}

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

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