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

// MessagesFoundStickerSetsNotModified represents TL type `messages.foundStickerSetsNotModified#d54b65d`.
// No further results were found
//
// See https://core.telegram.org/constructor/messages.foundStickerSetsNotModified for reference.
type MessagesFoundStickerSetsNotModified struct {
}

// MessagesFoundStickerSetsNotModifiedTypeID is TL type id of MessagesFoundStickerSetsNotModified.
const MessagesFoundStickerSetsNotModifiedTypeID = 0xd54b65d

// construct implements constructor of MessagesFoundStickerSetsClass.
func ( MessagesFoundStickerSetsNotModified) () MessagesFoundStickerSetsClass { return & }

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

	_ MessagesFoundStickerSetsClass = &MessagesFoundStickerSetsNotModified{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesFoundStickerSetsNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.foundStickerSetsNotModified#d54b65d as nil")
	}
	.PutID(MessagesFoundStickerSetsNotModifiedTypeID)
	return .EncodeBare()
}

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

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

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

// MessagesFoundStickerSets represents TL type `messages.foundStickerSets#8af09dd2`.
// Found stickersets
//
// See https://core.telegram.org/constructor/messages.foundStickerSets for reference.
type MessagesFoundStickerSets struct {
	// Hash for pagination, for more info click hereĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
	// Found stickersets
	Sets []StickerSetCoveredClass
}

// MessagesFoundStickerSetsTypeID is TL type id of MessagesFoundStickerSets.
const MessagesFoundStickerSetsTypeID = 0x8af09dd2

// construct implements constructor of MessagesFoundStickerSetsClass.
func ( MessagesFoundStickerSets) () MessagesFoundStickerSetsClass { return & }

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

	_ MessagesFoundStickerSetsClass = &MessagesFoundStickerSets{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesFoundStickerSets) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.foundStickerSets#8af09dd2 as nil")
	}
	.PutID(MessagesFoundStickerSetsTypeID)
	return .EncodeBare()
}

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

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

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

		if  > 0 {
			.Sets = make([]StickerSetCoveredClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeStickerSetCovered()
			if  != nil {
				return fmt.Errorf("unable to decode messages.foundStickerSets#8af09dd2: field sets: %w", )
			}
			.Sets = append(.Sets, )
		}
	}
	return nil
}

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

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

// MapSets returns field Sets wrapped in StickerSetCoveredClassArray helper.
func ( *MessagesFoundStickerSets) () ( StickerSetCoveredClassArray) {
	return StickerSetCoveredClassArray(.Sets)
}

// MessagesFoundStickerSetsClassName is schema name of MessagesFoundStickerSetsClass.
const MessagesFoundStickerSetsClassName = "messages.FoundStickerSets"

// MessagesFoundStickerSetsClass represents messages.FoundStickerSets generic type.
//
// See https://core.telegram.org/type/messages.FoundStickerSets for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesFoundStickerSets(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessagesFoundStickerSetsNotModified: // messages.foundStickerSetsNotModified#d54b65d
//	case *tg.MessagesFoundStickerSets: // messages.foundStickerSets#8af09dd2
//	default: panic(v)
//	}
type MessagesFoundStickerSetsClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesFoundStickerSetsClass

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

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

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

// DecodeMessagesFoundStickerSets implements binary de-serialization for MessagesFoundStickerSetsClass.
func ( *bin.Buffer) (MessagesFoundStickerSetsClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessagesFoundStickerSetsNotModifiedTypeID:
		// Decoding messages.foundStickerSetsNotModified#d54b65d.
		 := MessagesFoundStickerSetsNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesFoundStickerSetsClass: %w", )
		}
		return &, nil
	case MessagesFoundStickerSetsTypeID:
		// Decoding messages.foundStickerSets#8af09dd2.
		 := MessagesFoundStickerSets{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesFoundStickerSetsClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesFoundStickerSetsClass: %w", bin.NewUnexpectedID())
	}
}

// MessagesFoundStickerSets boxes the MessagesFoundStickerSetsClass providing a helper.
type MessagesFoundStickerSetsBox struct {
	FoundStickerSets MessagesFoundStickerSetsClass
}

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

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