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

// MessagesRecentStickersNotModified represents TL type `messages.recentStickersNotModified#b17f890`.
// No new recent sticker was found
//
// See https://core.telegram.org/constructor/messages.recentStickersNotModified for reference.
type MessagesRecentStickersNotModified struct {
}

// MessagesRecentStickersNotModifiedTypeID is TL type id of MessagesRecentStickersNotModified.
const MessagesRecentStickersNotModifiedTypeID = 0xb17f890

// construct implements constructor of MessagesRecentStickersClass.
func ( MessagesRecentStickersNotModified) () MessagesRecentStickersClass { return & }

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

	_ MessagesRecentStickersClass = &MessagesRecentStickersNotModified{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesRecentStickersNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.recentStickersNotModified#b17f890 as nil")
	}
	.PutID(MessagesRecentStickersNotModifiedTypeID)
	return .EncodeBare()
}

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

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

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

// MessagesRecentStickers represents TL type `messages.recentStickers#88d37c56`.
// Recently used stickers
//
// See https://core.telegram.org/constructor/messages.recentStickers for reference.
type MessagesRecentStickers 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
	// Recent stickers
	Stickers []DocumentClass
	// When was each sticker last used
	Dates []int
}

// MessagesRecentStickersTypeID is TL type id of MessagesRecentStickers.
const MessagesRecentStickersTypeID = 0x88d37c56

// construct implements constructor of MessagesRecentStickersClass.
func ( MessagesRecentStickers) () MessagesRecentStickersClass { return & }

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

	_ MessagesRecentStickersClass = &MessagesRecentStickers{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesRecentStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.recentStickers#88d37c56 as nil")
	}
	.PutID(MessagesRecentStickersTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesRecentStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.recentStickers#88d37c56 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.recentStickers#88d37c56: field hash: %w", )
		}
		.Hash = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.recentStickers#88d37c56: 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.recentStickers#88d37c56: field packs: %w", )
			}
			.Packs = append(.Packs, )
		}
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.recentStickers#88d37c56: field stickers: %w", )
		}

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

		if  > 0 {
			.Dates = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode messages.recentStickers#88d37c56: field dates: %w", )
			}
			.Dates = append(.Dates, )
		}
	}
	return nil
}

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

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

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

// GetDates returns value of Dates field.
func ( *MessagesRecentStickers) () ( []int) {
	if  == nil {
		return
	}
	return .Dates
}

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

// MessagesRecentStickersClassName is schema name of MessagesRecentStickersClass.
const MessagesRecentStickersClassName = "messages.RecentStickers"

// MessagesRecentStickersClass represents messages.RecentStickers generic type.
//
// See https://core.telegram.org/type/messages.RecentStickers for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesRecentStickers(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessagesRecentStickersNotModified: // messages.recentStickersNotModified#b17f890
//	case *tg.MessagesRecentStickers: // messages.recentStickers#88d37c56
//	default: panic(v)
//	}
type MessagesRecentStickersClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesRecentStickersClass

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

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

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

// DecodeMessagesRecentStickers implements binary de-serialization for MessagesRecentStickersClass.
func ( *bin.Buffer) (MessagesRecentStickersClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessagesRecentStickersNotModifiedTypeID:
		// Decoding messages.recentStickersNotModified#b17f890.
		 := MessagesRecentStickersNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesRecentStickersClass: %w", )
		}
		return &, nil
	case MessagesRecentStickersTypeID:
		// Decoding messages.recentStickers#88d37c56.
		 := MessagesRecentStickers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesRecentStickersClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesRecentStickersClass: %w", bin.NewUnexpectedID())
	}
}

// MessagesRecentStickers boxes the MessagesRecentStickersClass providing a helper.
type MessagesRecentStickersBox struct {
	RecentStickers MessagesRecentStickersClass
}

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

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