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

// EmojiListNotModified represents TL type `emojiListNotModified#481eadfa`.
// The list of custom emojis¹ hasn't changed.
//
// Links:
//  1. https://core.telegram.org/api/custom-emoji
//
// See https://core.telegram.org/constructor/emojiListNotModified for reference.
type EmojiListNotModified struct {
}

// EmojiListNotModifiedTypeID is TL type id of EmojiListNotModified.
const EmojiListNotModifiedTypeID = 0x481eadfa

// construct implements constructor of EmojiListClass.
func ( EmojiListNotModified) () EmojiListClass { return & }

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

	_ EmojiListClass = &EmojiListNotModified{}
)

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

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*EmojiListNotModified) () string {
	return "emojiListNotModified"
}

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

// Encode implements bin.Encoder.
func ( *EmojiListNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiListNotModified#481eadfa as nil")
	}
	.PutID(EmojiListNotModifiedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *EmojiListNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiListNotModified#481eadfa as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *EmojiListNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiListNotModified#481eadfa to nil")
	}
	if  := .ConsumeID(EmojiListNotModifiedTypeID);  != nil {
		return fmt.Errorf("unable to decode emojiListNotModified#481eadfa: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *EmojiListNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiListNotModified#481eadfa to nil")
	}
	return nil
}

// EmojiList represents TL type `emojiList#7a1e11d1`.
// Represents a list of custom emojis¹.
//
// Links:
//  1. https://core.telegram.org/api/custom-emoji
//
// See https://core.telegram.org/constructor/emojiList for reference.
type EmojiList struct {
	// Hash for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
	// Custom emoji IDs
	DocumentID []int64
}

// EmojiListTypeID is TL type id of EmojiList.
const EmojiListTypeID = 0x7a1e11d1

// construct implements constructor of EmojiListClass.
func ( EmojiList) () EmojiListClass { return & }

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

	_ EmojiListClass = &EmojiList{}
)

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

	return true
}

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

// FillFrom fills EmojiList from given interface.
func ( *EmojiList) ( interface {
	() ( int64)
	() ( []int64)
}) {
	.Hash = .()
	.DocumentID = .()
}

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

// TypeName returns name of type in TL schema.
func (*EmojiList) () string {
	return "emojiList"
}

// TypeInfo returns info about TL type.
func ( *EmojiList) () tdp.Type {
	 := tdp.Type{
		Name: "emojiList",
		ID:   EmojiListTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
		{
			Name:       "DocumentID",
			SchemaName: "document_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *EmojiList) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiList#7a1e11d1 as nil")
	}
	.PutID(EmojiListTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *EmojiList) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiList#7a1e11d1 as nil")
	}
	.PutLong(.Hash)
	.PutVectorHeader(len(.DocumentID))
	for ,  := range .DocumentID {
		.PutLong()
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *EmojiList) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiList#7a1e11d1 to nil")
	}
	if  := .ConsumeID(EmojiListTypeID);  != nil {
		return fmt.Errorf("unable to decode emojiList#7a1e11d1: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *EmojiList) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiList#7a1e11d1 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode emojiList#7a1e11d1: field hash: %w", )
		}
		.Hash = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode emojiList#7a1e11d1: field document_id: %w", )
		}

		if  > 0 {
			.DocumentID = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode emojiList#7a1e11d1: field document_id: %w", )
			}
			.DocumentID = append(.DocumentID, )
		}
	}
	return nil
}

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

// GetDocumentID returns value of DocumentID field.
func ( *EmojiList) () ( []int64) {
	if  == nil {
		return
	}
	return .DocumentID
}

// EmojiListClassName is schema name of EmojiListClass.
const EmojiListClassName = "EmojiList"

// EmojiListClass represents EmojiList generic type.
//
// See https://core.telegram.org/type/EmojiList for reference.
//
// Example:
//
//	g, err := tg.DecodeEmojiList(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.EmojiListNotModified: // emojiListNotModified#481eadfa
//	case *tg.EmojiList: // emojiList#7a1e11d1
//	default: panic(v)
//	}
type EmojiListClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() EmojiListClass

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

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

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

// DecodeEmojiList implements binary de-serialization for EmojiListClass.
func ( *bin.Buffer) (EmojiListClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case EmojiListNotModifiedTypeID:
		// Decoding emojiListNotModified#481eadfa.
		 := EmojiListNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode EmojiListClass: %w", )
		}
		return &, nil
	case EmojiListTypeID:
		// Decoding emojiList#7a1e11d1.
		 := EmojiList{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode EmojiListClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode EmojiListClass: %w", bin.NewUnexpectedID())
	}
}

// EmojiList boxes the EmojiListClass providing a helper.
type EmojiListBox struct {
	EmojiList EmojiListClass
}

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

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