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

// EmojiGroup represents TL type `emojiGroup#7a9abda9`.
// Represents an emoji category¹.
//
// Links:
//  1. https://core.telegram.org/api/emoji-categories
//
// See https://core.telegram.org/constructor/emojiGroup for reference.
type EmojiGroup struct {
	// Category name, i.e. "Animals", "Flags", "Faces" and so on...
	Title string
	// A single custom emoji used as preview for the category.
	IconEmojiID int64
	// A list of UTF-8 emojis, matching the category.
	Emoticons []string
}

// EmojiGroupTypeID is TL type id of EmojiGroup.
const EmojiGroupTypeID = 0x7a9abda9

// construct implements constructor of EmojiGroupClass.
func ( EmojiGroup) () EmojiGroupClass { return & }

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

	_ EmojiGroupClass = &EmojiGroup{}
)

func ( *EmojiGroup) () bool {
	if  == nil {
		return true
	}
	if !(.Title == "") {
		return false
	}
	if !(.IconEmojiID == 0) {
		return false
	}
	if !(.Emoticons == nil) {
		return false
	}

	return true
}

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

// FillFrom fills EmojiGroup from given interface.
func ( *EmojiGroup) ( interface {
	() ( string)
	() ( int64)
	() ( []string)
}) {
	.Title = .()
	.IconEmojiID = .()
	.Emoticons = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *EmojiGroup) () tdp.Type {
	 := tdp.Type{
		Name: "emojiGroup",
		ID:   EmojiGroupTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "IconEmojiID",
			SchemaName: "icon_emoji_id",
		},
		{
			Name:       "Emoticons",
			SchemaName: "emoticons",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *EmojiGroup) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiGroup#7a9abda9 as nil")
	}
	.PutID(EmojiGroupTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *EmojiGroup) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiGroup#7a9abda9 as nil")
	}
	.PutString(.Title)
	.PutLong(.IconEmojiID)
	.PutVectorHeader(len(.Emoticons))
	for ,  := range .Emoticons {
		.PutString()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *EmojiGroup) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiGroup#7a9abda9 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode emojiGroup#7a9abda9: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode emojiGroup#7a9abda9: field icon_emoji_id: %w", )
		}
		.IconEmojiID = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode emojiGroup#7a9abda9: field emoticons: %w", )
		}

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

// GetTitle returns value of Title field.
func ( *EmojiGroup) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// GetIconEmojiID returns value of IconEmojiID field.
func ( *EmojiGroup) () ( int64) {
	if  == nil {
		return
	}
	return .IconEmojiID
}

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

// EmojiGroupGreeting represents TL type `emojiGroupGreeting#80d26cc7`.
// Represents an emoji category¹, that should be moved to the top of the list when
// choosing a sticker for a business introduction²
//
// Links:
//  1. https://core.telegram.org/api/emoji-categories
//  2. https://core.telegram.org/api/business#business-introduction
//
// See https://core.telegram.org/constructor/emojiGroupGreeting for reference.
type EmojiGroupGreeting struct {
	// Category name, i.e. "Animals", "Flags", "Faces" and so on...
	Title string
	// A single custom emoji used as preview for the category.
	IconEmojiID int64
	// A list of UTF-8 emojis, matching the category.
	Emoticons []string
}

// EmojiGroupGreetingTypeID is TL type id of EmojiGroupGreeting.
const EmojiGroupGreetingTypeID = 0x80d26cc7

// construct implements constructor of EmojiGroupClass.
func ( EmojiGroupGreeting) () EmojiGroupClass { return & }

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

	_ EmojiGroupClass = &EmojiGroupGreeting{}
)

func ( *EmojiGroupGreeting) () bool {
	if  == nil {
		return true
	}
	if !(.Title == "") {
		return false
	}
	if !(.IconEmojiID == 0) {
		return false
	}
	if !(.Emoticons == nil) {
		return false
	}

	return true
}

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

// FillFrom fills EmojiGroupGreeting from given interface.
func ( *EmojiGroupGreeting) ( interface {
	() ( string)
	() ( int64)
	() ( []string)
}) {
	.Title = .()
	.IconEmojiID = .()
	.Emoticons = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *EmojiGroupGreeting) () tdp.Type {
	 := tdp.Type{
		Name: "emojiGroupGreeting",
		ID:   EmojiGroupGreetingTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "IconEmojiID",
			SchemaName: "icon_emoji_id",
		},
		{
			Name:       "Emoticons",
			SchemaName: "emoticons",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *EmojiGroupGreeting) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiGroupGreeting#80d26cc7 as nil")
	}
	.PutID(EmojiGroupGreetingTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *EmojiGroupGreeting) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiGroupGreeting#80d26cc7 as nil")
	}
	.PutString(.Title)
	.PutLong(.IconEmojiID)
	.PutVectorHeader(len(.Emoticons))
	for ,  := range .Emoticons {
		.PutString()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *EmojiGroupGreeting) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiGroupGreeting#80d26cc7 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode emojiGroupGreeting#80d26cc7: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode emojiGroupGreeting#80d26cc7: field icon_emoji_id: %w", )
		}
		.IconEmojiID = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode emojiGroupGreeting#80d26cc7: field emoticons: %w", )
		}

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

// GetTitle returns value of Title field.
func ( *EmojiGroupGreeting) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// GetIconEmojiID returns value of IconEmojiID field.
func ( *EmojiGroupGreeting) () ( int64) {
	if  == nil {
		return
	}
	return .IconEmojiID
}

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

// EmojiGroupPremium represents TL type `emojiGroupPremium#93bcf34`.
// An emoji category¹, used to select all Premium²-only stickers (i.e. those with a
// Premium effect »³)/Premium⁴-only custom emojis⁵ (i.e. those where the
// documentAttributeCustomEmoji⁶.free flag is not set)
//
// Links:
//  1. https://core.telegram.org/api/emoji-categories
//  2. https://core.telegram.org/api/premium
//  3. https://core.telegram.org/api/stickers#premium-animated-sticker-effects
//  4. https://core.telegram.org/api/premium
//  5. https://core.telegram.org/api/custom-emoji
//  6. https://core.telegram.org/constructor/documentAttributeCustomEmoji
//
// See https://core.telegram.org/constructor/emojiGroupPremium for reference.
type EmojiGroupPremium struct {
	// Category name, i.e. "Animals", "Flags", "Faces" and so on...
	Title string
	// A single custom emoji used as preview for the category.
	IconEmojiID int64
}

// EmojiGroupPremiumTypeID is TL type id of EmojiGroupPremium.
const EmojiGroupPremiumTypeID = 0x93bcf34

// construct implements constructor of EmojiGroupClass.
func ( EmojiGroupPremium) () EmojiGroupClass { return & }

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

	_ EmojiGroupClass = &EmojiGroupPremium{}
)

func ( *EmojiGroupPremium) () bool {
	if  == nil {
		return true
	}
	if !(.Title == "") {
		return false
	}
	if !(.IconEmojiID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills EmojiGroupPremium from given interface.
func ( *EmojiGroupPremium) ( interface {
	() ( string)
	() ( int64)
}) {
	.Title = .()
	.IconEmojiID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *EmojiGroupPremium) () tdp.Type {
	 := tdp.Type{
		Name: "emojiGroupPremium",
		ID:   EmojiGroupPremiumTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "IconEmojiID",
			SchemaName: "icon_emoji_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *EmojiGroupPremium) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiGroupPremium#93bcf34 as nil")
	}
	.PutID(EmojiGroupPremiumTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *EmojiGroupPremium) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode emojiGroupPremium#93bcf34 as nil")
	}
	.PutString(.Title)
	.PutLong(.IconEmojiID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *EmojiGroupPremium) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode emojiGroupPremium#93bcf34 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode emojiGroupPremium#93bcf34: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode emojiGroupPremium#93bcf34: field icon_emoji_id: %w", )
		}
		.IconEmojiID = 
	}
	return nil
}

// GetTitle returns value of Title field.
func ( *EmojiGroupPremium) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// GetIconEmojiID returns value of IconEmojiID field.
func ( *EmojiGroupPremium) () ( int64) {
	if  == nil {
		return
	}
	return .IconEmojiID
}

// EmojiGroupClassName is schema name of EmojiGroupClass.
const EmojiGroupClassName = "EmojiGroup"

// EmojiGroupClass represents EmojiGroup generic type.
//
// See https://core.telegram.org/type/EmojiGroup for reference.
//
// Constructors:
//   - [EmojiGroup]
//   - [EmojiGroupGreeting]
//   - [EmojiGroupPremium]
//
// Example:
//
//	g, err := tg.DecodeEmojiGroup(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.EmojiGroup: // emojiGroup#7a9abda9
//	case *tg.EmojiGroupGreeting: // emojiGroupGreeting#80d26cc7
//	case *tg.EmojiGroupPremium: // emojiGroupPremium#93bcf34
//	default: panic(v)
//	}
type EmojiGroupClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() EmojiGroupClass

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

	// Category name, i.e. "Animals", "Flags", "Faces" and so on...
	GetTitle() (value string)

	// A single custom emoji used as preview for the category.
	GetIconEmojiID() (value int64)
}

// DecodeEmojiGroup implements binary de-serialization for EmojiGroupClass.
func ( *bin.Buffer) (EmojiGroupClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case EmojiGroupTypeID:
		// Decoding emojiGroup#7a9abda9.
		 := EmojiGroup{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode EmojiGroupClass: %w", )
		}
		return &, nil
	case EmojiGroupGreetingTypeID:
		// Decoding emojiGroupGreeting#80d26cc7.
		 := EmojiGroupGreeting{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode EmojiGroupClass: %w", )
		}
		return &, nil
	case EmojiGroupPremiumTypeID:
		// Decoding emojiGroupPremium#93bcf34.
		 := EmojiGroupPremium{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode EmojiGroupClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode EmojiGroupClass: %w", bin.NewUnexpectedID())
	}
}

// EmojiGroup boxes the EmojiGroupClass providing a helper.
type EmojiGroupBox struct {
	EmojiGroup EmojiGroupClass
}

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

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