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

// EmojiKeyword represents TL type `emojiKeyword#d5b3b9f9`.
// Emoji keyword
//
// See https://core.telegram.org/constructor/emojiKeyword for reference.
type EmojiKeyword struct {
	// Keyword
	Keyword string
	// Emojis associated to keyword
	Emoticons []string
}

// EmojiKeywordTypeID is TL type id of EmojiKeyword.
const EmojiKeywordTypeID = 0xd5b3b9f9

// construct implements constructor of EmojiKeywordClass.
func ( EmojiKeyword) () EmojiKeywordClass { return & }

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

	_ EmojiKeywordClass = &EmojiKeyword{}
)

func ( *EmojiKeyword) () bool {
	if  == nil {
		return true
	}
	if !(.Keyword == "") {
		return false
	}
	if !(.Emoticons == nil) {
		return false
	}

	return true
}

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

// FillFrom fills EmojiKeyword from given interface.
func ( *EmojiKeyword) ( interface {
	() ( string)
	() ( []string)
}) {
	.Keyword = .()
	.Emoticons = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *EmojiKeyword) () tdp.Type {
	 := tdp.Type{
		Name: "emojiKeyword",
		ID:   EmojiKeywordTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Keyword",
			SchemaName: "keyword",
		},
		{
			Name:       "Emoticons",
			SchemaName: "emoticons",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *EmojiKeyword) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiKeyword#d5b3b9f9 as nil")
	}
	.PutID(EmojiKeywordTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *EmojiKeyword) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiKeyword#d5b3b9f9 as nil")
	}
	.PutString(.Keyword)
	.PutVectorHeader(len(.Emoticons))
	for ,  := range .Emoticons {
		.PutString()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *EmojiKeyword) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiKeyword#d5b3b9f9 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode emojiKeyword#d5b3b9f9: field keyword: %w", )
		}
		.Keyword = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode emojiKeyword#d5b3b9f9: field emoticons: %w", )
		}

		if  > 0 {
			.Emoticons = make([]string, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .String()
			if  != nil {
				return fmt.Errorf("unable to decode emojiKeyword#d5b3b9f9: field emoticons: %w", )
			}
			.Emoticons = append(.Emoticons, )
		}
	}
	return nil
}

// GetKeyword returns value of Keyword field.
func ( *EmojiKeyword) () ( string) {
	if  == nil {
		return
	}
	return .Keyword
}

// GetEmoticons returns value of Emoticons field.
func ( *EmojiKeyword) () ( []string) {
	if  == nil {
		return
	}
	return .Emoticons
}

// EmojiKeywordDeleted represents TL type `emojiKeywordDeleted#236df622`.
// Deleted emoji keyword
//
// See https://core.telegram.org/constructor/emojiKeywordDeleted for reference.
type EmojiKeywordDeleted struct {
	// Keyword
	Keyword string
	// Emojis that were associated to keyword
	Emoticons []string
}

// EmojiKeywordDeletedTypeID is TL type id of EmojiKeywordDeleted.
const EmojiKeywordDeletedTypeID = 0x236df622

// construct implements constructor of EmojiKeywordClass.
func ( EmojiKeywordDeleted) () EmojiKeywordClass { return & }

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

	_ EmojiKeywordClass = &EmojiKeywordDeleted{}
)

func ( *EmojiKeywordDeleted) () bool {
	if  == nil {
		return true
	}
	if !(.Keyword == "") {
		return false
	}
	if !(.Emoticons == nil) {
		return false
	}

	return true
}

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

// FillFrom fills EmojiKeywordDeleted from given interface.
func ( *EmojiKeywordDeleted) ( interface {
	() ( string)
	() ( []string)
}) {
	.Keyword = .()
	.Emoticons = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *EmojiKeywordDeleted) () tdp.Type {
	 := tdp.Type{
		Name: "emojiKeywordDeleted",
		ID:   EmojiKeywordDeletedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Keyword",
			SchemaName: "keyword",
		},
		{
			Name:       "Emoticons",
			SchemaName: "emoticons",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *EmojiKeywordDeleted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiKeywordDeleted#236df622 as nil")
	}
	.PutID(EmojiKeywordDeletedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *EmojiKeywordDeleted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiKeywordDeleted#236df622 as nil")
	}
	.PutString(.Keyword)
	.PutVectorHeader(len(.Emoticons))
	for ,  := range .Emoticons {
		.PutString()
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *EmojiKeywordDeleted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiKeywordDeleted#236df622 to nil")
	}
	if  := .ConsumeID(EmojiKeywordDeletedTypeID);  != nil {
		return fmt.Errorf("unable to decode emojiKeywordDeleted#236df622: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *EmojiKeywordDeleted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiKeywordDeleted#236df622 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode emojiKeywordDeleted#236df622: field keyword: %w", )
		}
		.Keyword = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode emojiKeywordDeleted#236df622: field emoticons: %w", )
		}

		if  > 0 {
			.Emoticons = make([]string, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .String()
			if  != nil {
				return fmt.Errorf("unable to decode emojiKeywordDeleted#236df622: field emoticons: %w", )
			}
			.Emoticons = append(.Emoticons, )
		}
	}
	return nil
}

// GetKeyword returns value of Keyword field.
func ( *EmojiKeywordDeleted) () ( string) {
	if  == nil {
		return
	}
	return .Keyword
}

// GetEmoticons returns value of Emoticons field.
func ( *EmojiKeywordDeleted) () ( []string) {
	if  == nil {
		return
	}
	return .Emoticons
}

// EmojiKeywordClassName is schema name of EmojiKeywordClass.
const EmojiKeywordClassName = "EmojiKeyword"

// EmojiKeywordClass represents EmojiKeyword generic type.
//
// See https://core.telegram.org/type/EmojiKeyword for reference.
//
// Example:
//
//	g, err := tg.DecodeEmojiKeyword(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.EmojiKeyword: // emojiKeyword#d5b3b9f9
//	case *tg.EmojiKeywordDeleted: // emojiKeywordDeleted#236df622
//	default: panic(v)
//	}
type EmojiKeywordClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() EmojiKeywordClass

	// 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

	// Keyword
	GetKeyword() (value string)

	// Emojis associated to keyword
	GetEmoticons() (value []string)
}

// DecodeEmojiKeyword implements binary de-serialization for EmojiKeywordClass.
func ( *bin.Buffer) (EmojiKeywordClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case EmojiKeywordTypeID:
		// Decoding emojiKeyword#d5b3b9f9.
		 := EmojiKeyword{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode EmojiKeywordClass: %w", )
		}
		return &, nil
	case EmojiKeywordDeletedTypeID:
		// Decoding emojiKeywordDeleted#236df622.
		 := EmojiKeywordDeleted{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode EmojiKeywordClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode EmojiKeywordClass: %w", bin.NewUnexpectedID())
	}
}

// EmojiKeyword boxes the EmojiKeywordClass providing a helper.
type EmojiKeywordBox struct {
	EmojiKeyword EmojiKeywordClass
}

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

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