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

// MessagesStickersNotModified represents TL type `messages.stickersNotModified#f1749a22`.
// No new stickers were found for the given query
//
// See https://core.telegram.org/constructor/messages.stickersNotModified for reference.
type MessagesStickersNotModified struct {
}

// MessagesStickersNotModifiedTypeID is TL type id of MessagesStickersNotModified.
const MessagesStickersNotModifiedTypeID = 0xf1749a22

// construct implements constructor of MessagesStickersClass.
func ( MessagesStickersNotModified) () MessagesStickersClass { return & }

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

	_ MessagesStickersClass = &MessagesStickersNotModified{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesStickersNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickersNotModified#f1749a22 as nil")
	}
	.PutID(MessagesStickersNotModifiedTypeID)
	return .EncodeBare()
}

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

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

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

// MessagesStickers represents TL type `messages.stickers#30a6ec7e`.
// Found stickers
//
// See https://core.telegram.org/constructor/messages.stickers for reference.
type MessagesStickers struct {
	// Hash for pagination, for more info click hereĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
	// Stickers
	Stickers []DocumentClass
}

// MessagesStickersTypeID is TL type id of MessagesStickers.
const MessagesStickersTypeID = 0x30a6ec7e

// construct implements constructor of MessagesStickersClass.
func ( MessagesStickers) () MessagesStickersClass { return & }

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

	_ MessagesStickersClass = &MessagesStickers{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesStickers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.stickers#30a6ec7e as nil")
	}
	.PutID(MessagesStickersTypeID)
	return .EncodeBare()
}

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

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

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

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

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

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

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

// MessagesStickersClassName is schema name of MessagesStickersClass.
const MessagesStickersClassName = "messages.Stickers"

// MessagesStickersClass represents messages.Stickers generic type.
//
// See https://core.telegram.org/type/messages.Stickers for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesStickers(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessagesStickersNotModified: // messages.stickersNotModified#f1749a22
//	case *tg.MessagesStickers: // messages.stickers#30a6ec7e
//	default: panic(v)
//	}
type MessagesStickersClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesStickersClass

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

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

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

// DecodeMessagesStickers implements binary de-serialization for MessagesStickersClass.
func ( *bin.Buffer) (MessagesStickersClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessagesStickersNotModifiedTypeID:
		// Decoding messages.stickersNotModified#f1749a22.
		 := MessagesStickersNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesStickersClass: %w", )
		}
		return &, nil
	case MessagesStickersTypeID:
		// Decoding messages.stickers#30a6ec7e.
		 := MessagesStickers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesStickersClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesStickersClass: %w", bin.NewUnexpectedID())
	}
}

// MessagesStickers boxes the MessagesStickersClass providing a helper.
type MessagesStickersBox struct {
	Stickers MessagesStickersClass
}

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

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