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

// MessagesEmojiGroupsNotModified represents TL type `messages.emojiGroupsNotModified#6fb4ad87`.
// The list of emoji categories¹ hasn't changed.
//
// Links:
//  1. https://core.telegram.org/api/custom-emoji#emoji-categories
//
// See https://core.telegram.org/constructor/messages.emojiGroupsNotModified for reference.
type MessagesEmojiGroupsNotModified struct {
}

// MessagesEmojiGroupsNotModifiedTypeID is TL type id of MessagesEmojiGroupsNotModified.
const MessagesEmojiGroupsNotModifiedTypeID = 0x6fb4ad87

// construct implements constructor of MessagesEmojiGroupsClass.
func ( MessagesEmojiGroupsNotModified) () MessagesEmojiGroupsClass { return & }

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

	_ MessagesEmojiGroupsClass = &MessagesEmojiGroupsNotModified{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesEmojiGroupsNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.emojiGroupsNotModified#6fb4ad87 as nil")
	}
	.PutID(MessagesEmojiGroupsNotModifiedTypeID)
	return .EncodeBare()
}

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

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

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

// MessagesEmojiGroups represents TL type `messages.emojiGroups#881fb94b`.
// Represents a list of emoji categories¹.
//
// Links:
//  1. https://core.telegram.org/api/custom-emoji#emoji-categories
//
// See https://core.telegram.org/constructor/messages.emojiGroups for reference.
type MessagesEmojiGroups struct {
	// Hash for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int
	// A list of emoji categories¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji#emoji-categories
	Groups []EmojiGroup
}

// MessagesEmojiGroupsTypeID is TL type id of MessagesEmojiGroups.
const MessagesEmojiGroupsTypeID = 0x881fb94b

// construct implements constructor of MessagesEmojiGroupsClass.
func ( MessagesEmojiGroups) () MessagesEmojiGroupsClass { return & }

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

	_ MessagesEmojiGroupsClass = &MessagesEmojiGroups{}
)

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

	return true
}

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

// FillFrom fills MessagesEmojiGroups from given interface.
func ( *MessagesEmojiGroups) ( interface {
	() ( int)
	() ( []EmojiGroup)
}) {
	.Hash = .()
	.Groups = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesEmojiGroups) () tdp.Type {
	 := tdp.Type{
		Name: "messages.emojiGroups",
		ID:   MessagesEmojiGroupsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
		{
			Name:       "Groups",
			SchemaName: "groups",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesEmojiGroups) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.emojiGroups#881fb94b as nil")
	}
	.PutID(MessagesEmojiGroupsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesEmojiGroups) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.emojiGroups#881fb94b as nil")
	}
	.PutInt(.Hash)
	.PutVectorHeader(len(.Groups))
	for ,  := range .Groups {
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode messages.emojiGroups#881fb94b: field groups element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesEmojiGroups) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.emojiGroups#881fb94b to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.emojiGroups#881fb94b: field hash: %w", )
		}
		.Hash = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.emojiGroups#881fb94b: field groups: %w", )
		}

		if  > 0 {
			.Groups = make([]EmojiGroup, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			var  EmojiGroup
			if  := .Decode();  != nil {
				return fmt.Errorf("unable to decode messages.emojiGroups#881fb94b: field groups: %w", )
			}
			.Groups = append(.Groups, )
		}
	}
	return nil
}

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

// GetGroups returns value of Groups field.
func ( *MessagesEmojiGroups) () ( []EmojiGroup) {
	if  == nil {
		return
	}
	return .Groups
}

// MessagesEmojiGroupsClassName is schema name of MessagesEmojiGroupsClass.
const MessagesEmojiGroupsClassName = "messages.EmojiGroups"

// MessagesEmojiGroupsClass represents messages.EmojiGroups generic type.
//
// See https://core.telegram.org/type/messages.EmojiGroups for reference.
//
// Example:
//
//	g, err := tg.DecodeMessagesEmojiGroups(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.MessagesEmojiGroupsNotModified: // messages.emojiGroupsNotModified#6fb4ad87
//	case *tg.MessagesEmojiGroups: // messages.emojiGroups#881fb94b
//	default: panic(v)
//	}
type MessagesEmojiGroupsClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() MessagesEmojiGroupsClass

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

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

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

// DecodeMessagesEmojiGroups implements binary de-serialization for MessagesEmojiGroupsClass.
func ( *bin.Buffer) (MessagesEmojiGroupsClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case MessagesEmojiGroupsNotModifiedTypeID:
		// Decoding messages.emojiGroupsNotModified#6fb4ad87.
		 := MessagesEmojiGroupsNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesEmojiGroupsClass: %w", )
		}
		return &, nil
	case MessagesEmojiGroupsTypeID:
		// Decoding messages.emojiGroups#881fb94b.
		 := MessagesEmojiGroups{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode MessagesEmojiGroupsClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode MessagesEmojiGroupsClass: %w", bin.NewUnexpectedID())
	}
}

// MessagesEmojiGroups boxes the MessagesEmojiGroupsClass providing a helper.
type MessagesEmojiGroupsBox struct {
	EmojiGroups MessagesEmojiGroupsClass
}

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

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