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

// AccountEmojiStatusesNotModified represents TL type `account.emojiStatusesNotModified#d08ce645`.
// The server-side list of emoji statuses¹ hasn't changed
//
// Links:
//  1. https://core.telegram.org/api/emoji-status
//
// See https://core.telegram.org/constructor/account.emojiStatusesNotModified for reference.
type AccountEmojiStatusesNotModified struct {
}

// AccountEmojiStatusesNotModifiedTypeID is TL type id of AccountEmojiStatusesNotModified.
const AccountEmojiStatusesNotModifiedTypeID = 0xd08ce645

// construct implements constructor of AccountEmojiStatusesClass.
func ( AccountEmojiStatusesNotModified) () AccountEmojiStatusesClass { return & }

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

	_ AccountEmojiStatusesClass = &AccountEmojiStatusesNotModified{}
)

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

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*AccountEmojiStatusesNotModified) () string {
	return "account.emojiStatusesNotModified"
}

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

// Encode implements bin.Encoder.
func ( *AccountEmojiStatusesNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.emojiStatusesNotModified#d08ce645 as nil")
	}
	.PutID(AccountEmojiStatusesNotModifiedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountEmojiStatusesNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.emojiStatusesNotModified#d08ce645 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountEmojiStatusesNotModified) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.emojiStatusesNotModified#d08ce645 to nil")
	}
	return nil
}

// AccountEmojiStatuses represents TL type `account.emojiStatuses#90c467d1`.
// A list of emoji statuses¹
//
// Links:
//  1. https://core.telegram.org/api/emoji-status
//
// See https://core.telegram.org/constructor/account.emojiStatuses for reference.
type AccountEmojiStatuses struct {
	// Hash for pagination, for more info click here¹
	//
	// Links:
	//  1) https://core.telegram.org/api/offsets#hash-generation
	Hash int64
	// Emoji statuses¹
	//
	// Links:
	//  1) https://core.telegram.org/api/emoji-status
	Statuses []EmojiStatusClass
}

// AccountEmojiStatusesTypeID is TL type id of AccountEmojiStatuses.
const AccountEmojiStatusesTypeID = 0x90c467d1

// construct implements constructor of AccountEmojiStatusesClass.
func ( AccountEmojiStatuses) () AccountEmojiStatusesClass { return & }

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

	_ AccountEmojiStatusesClass = &AccountEmojiStatuses{}
)

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

	return true
}

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

// FillFrom fills AccountEmojiStatuses from given interface.
func ( *AccountEmojiStatuses) ( interface {
	() ( int64)
	() ( []EmojiStatusClass)
}) {
	.Hash = .()
	.Statuses = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountEmojiStatuses) () string {
	return "account.emojiStatuses"
}

// TypeInfo returns info about TL type.
func ( *AccountEmojiStatuses) () tdp.Type {
	 := tdp.Type{
		Name: "account.emojiStatuses",
		ID:   AccountEmojiStatusesTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
		{
			Name:       "Statuses",
			SchemaName: "statuses",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountEmojiStatuses) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.emojiStatuses#90c467d1 as nil")
	}
	.PutID(AccountEmojiStatusesTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountEmojiStatuses) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.emojiStatuses#90c467d1 as nil")
	}
	.PutLong(.Hash)
	.PutVectorHeader(len(.Statuses))
	for ,  := range .Statuses {
		if  == nil {
			return fmt.Errorf("unable to encode account.emojiStatuses#90c467d1: field statuses element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode account.emojiStatuses#90c467d1: field statuses element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountEmojiStatuses) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.emojiStatuses#90c467d1 to nil")
	}
	if  := .ConsumeID(AccountEmojiStatusesTypeID);  != nil {
		return fmt.Errorf("unable to decode account.emojiStatuses#90c467d1: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountEmojiStatuses) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.emojiStatuses#90c467d1 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode account.emojiStatuses#90c467d1: field hash: %w", )
		}
		.Hash = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode account.emojiStatuses#90c467d1: field statuses: %w", )
		}

		if  > 0 {
			.Statuses = make([]EmojiStatusClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeEmojiStatus()
			if  != nil {
				return fmt.Errorf("unable to decode account.emojiStatuses#90c467d1: field statuses: %w", )
			}
			.Statuses = append(.Statuses, )
		}
	}
	return nil
}

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

// GetStatuses returns value of Statuses field.
func ( *AccountEmojiStatuses) () ( []EmojiStatusClass) {
	if  == nil {
		return
	}
	return .Statuses
}

// MapStatuses returns field Statuses wrapped in EmojiStatusClassArray helper.
func ( *AccountEmojiStatuses) () ( EmojiStatusClassArray) {
	return EmojiStatusClassArray(.Statuses)
}

// AccountEmojiStatusesClassName is schema name of AccountEmojiStatusesClass.
const AccountEmojiStatusesClassName = "account.EmojiStatuses"

// AccountEmojiStatusesClass represents account.EmojiStatuses generic type.
//
// See https://core.telegram.org/type/account.EmojiStatuses for reference.
//
// Example:
//
//	g, err := tg.DecodeAccountEmojiStatuses(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.AccountEmojiStatusesNotModified: // account.emojiStatusesNotModified#d08ce645
//	case *tg.AccountEmojiStatuses: // account.emojiStatuses#90c467d1
//	default: panic(v)
//	}
type AccountEmojiStatusesClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() AccountEmojiStatusesClass

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

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

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

// DecodeAccountEmojiStatuses implements binary de-serialization for AccountEmojiStatusesClass.
func ( *bin.Buffer) (AccountEmojiStatusesClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case AccountEmojiStatusesNotModifiedTypeID:
		// Decoding account.emojiStatusesNotModified#d08ce645.
		 := AccountEmojiStatusesNotModified{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode AccountEmojiStatusesClass: %w", )
		}
		return &, nil
	case AccountEmojiStatusesTypeID:
		// Decoding account.emojiStatuses#90c467d1.
		 := AccountEmojiStatuses{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode AccountEmojiStatusesClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode AccountEmojiStatusesClass: %w", bin.NewUnexpectedID())
	}
}

// AccountEmojiStatuses boxes the AccountEmojiStatusesClass providing a helper.
type AccountEmojiStatusesBox struct {
	EmojiStatuses AccountEmojiStatusesClass
}

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

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