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

// EmojiKeywordsDifference represents TL type `emojiKeywordsDifference#5cc761bd`.
// Changes to emoji keywords
//
// See https://core.telegram.org/constructor/emojiKeywordsDifference for reference.
type EmojiKeywordsDifference struct {
	// Language code for keywords
	LangCode string
	// Previous emoji keyword list version
	FromVersion int
	// Current version of emoji keyword list
	Version int
	// Emojis associated to keywords
	Keywords []EmojiKeywordClass
}

// EmojiKeywordsDifferenceTypeID is TL type id of EmojiKeywordsDifference.
const EmojiKeywordsDifferenceTypeID = 0x5cc761bd

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

func ( *EmojiKeywordsDifference) () bool {
	if  == nil {
		return true
	}
	if !(.LangCode == "") {
		return false
	}
	if !(.FromVersion == 0) {
		return false
	}
	if !(.Version == 0) {
		return false
	}
	if !(.Keywords == nil) {
		return false
	}

	return true
}

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

// FillFrom fills EmojiKeywordsDifference from given interface.
func ( *EmojiKeywordsDifference) ( interface {
	() ( string)
	() ( int)
	() ( int)
	() ( []EmojiKeywordClass)
}) {
	.LangCode = .()
	.FromVersion = .()
	.Version = .()
	.Keywords = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *EmojiKeywordsDifference) () tdp.Type {
	 := tdp.Type{
		Name: "emojiKeywordsDifference",
		ID:   EmojiKeywordsDifferenceTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "LangCode",
			SchemaName: "lang_code",
		},
		{
			Name:       "FromVersion",
			SchemaName: "from_version",
		},
		{
			Name:       "Version",
			SchemaName: "version",
		},
		{
			Name:       "Keywords",
			SchemaName: "keywords",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *EmojiKeywordsDifference) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiKeywordsDifference#5cc761bd as nil")
	}
	.PutID(EmojiKeywordsDifferenceTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *EmojiKeywordsDifference) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiKeywordsDifference#5cc761bd as nil")
	}
	.PutString(.LangCode)
	.PutInt(.FromVersion)
	.PutInt(.Version)
	.PutVectorHeader(len(.Keywords))
	for ,  := range .Keywords {
		if  == nil {
			return fmt.Errorf("unable to encode emojiKeywordsDifference#5cc761bd: field keywords element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode emojiKeywordsDifference#5cc761bd: field keywords element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *EmojiKeywordsDifference) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiKeywordsDifference#5cc761bd to nil")
	}
	if  := .ConsumeID(EmojiKeywordsDifferenceTypeID);  != nil {
		return fmt.Errorf("unable to decode emojiKeywordsDifference#5cc761bd: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *EmojiKeywordsDifference) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiKeywordsDifference#5cc761bd to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode emojiKeywordsDifference#5cc761bd: field lang_code: %w", )
		}
		.LangCode = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode emojiKeywordsDifference#5cc761bd: field from_version: %w", )
		}
		.FromVersion = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode emojiKeywordsDifference#5cc761bd: field version: %w", )
		}
		.Version = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode emojiKeywordsDifference#5cc761bd: field keywords: %w", )
		}

		if  > 0 {
			.Keywords = make([]EmojiKeywordClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeEmojiKeyword()
			if  != nil {
				return fmt.Errorf("unable to decode emojiKeywordsDifference#5cc761bd: field keywords: %w", )
			}
			.Keywords = append(.Keywords, )
		}
	}
	return nil
}

// GetLangCode returns value of LangCode field.
func ( *EmojiKeywordsDifference) () ( string) {
	if  == nil {
		return
	}
	return .LangCode
}

// GetFromVersion returns value of FromVersion field.
func ( *EmojiKeywordsDifference) () ( int) {
	if  == nil {
		return
	}
	return .FromVersion
}

// GetVersion returns value of Version field.
func ( *EmojiKeywordsDifference) () ( int) {
	if  == nil {
		return
	}
	return .Version
}

// GetKeywords returns value of Keywords field.
func ( *EmojiKeywordsDifference) () ( []EmojiKeywordClass) {
	if  == nil {
		return
	}
	return .Keywords
}

// MapKeywords returns field Keywords wrapped in EmojiKeywordClassArray helper.
func ( *EmojiKeywordsDifference) () ( EmojiKeywordClassArray) {
	return EmojiKeywordClassArray(.Keywords)
}