// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)

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

// TopPeerCategoryBotsPM represents TL type `topPeerCategoryBotsPM#ab661b5b`.
// Most used bots
//
// See https://core.telegram.org/constructor/topPeerCategoryBotsPM for reference.
type TopPeerCategoryBotsPM struct {
}

// TopPeerCategoryBotsPMTypeID is TL type id of TopPeerCategoryBotsPM.
const TopPeerCategoryBotsPMTypeID = 0xab661b5b

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryBotsPM) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryBotsPM{}
)

func (t *TopPeerCategoryBotsPM) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryBotsPM) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryBotsPM",
		ID:   TopPeerCategoryBotsPMTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryBotsPM) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryBotsPM#ab661b5b as nil")
	}
	b.PutID(TopPeerCategoryBotsPMTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryBotsPM) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryBotsPM#ab661b5b as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryBotsPM) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryBotsPM#ab661b5b to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryBotsPMTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryBotsPM#ab661b5b: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryBotsPM) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryBotsPM#ab661b5b to nil")
	}
	return nil
}

// TopPeerCategoryBotsInline represents TL type `topPeerCategoryBotsInline#148677e2`.
// Most used inline bots
//
// See https://core.telegram.org/constructor/topPeerCategoryBotsInline for reference.
type TopPeerCategoryBotsInline struct {
}

// TopPeerCategoryBotsInlineTypeID is TL type id of TopPeerCategoryBotsInline.
const TopPeerCategoryBotsInlineTypeID = 0x148677e2

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryBotsInline) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryBotsInline{}
)

func (t *TopPeerCategoryBotsInline) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryBotsInline) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryBotsInline",
		ID:   TopPeerCategoryBotsInlineTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryBotsInline) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryBotsInline#148677e2 as nil")
	}
	b.PutID(TopPeerCategoryBotsInlineTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryBotsInline) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryBotsInline#148677e2 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryBotsInline) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryBotsInline#148677e2 to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryBotsInlineTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryBotsInline#148677e2: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryBotsInline) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryBotsInline#148677e2 to nil")
	}
	return nil
}

// TopPeerCategoryCorrespondents represents TL type `topPeerCategoryCorrespondents#637b7ed`.
// Users we've chatted most frequently with
//
// See https://core.telegram.org/constructor/topPeerCategoryCorrespondents for reference.
type TopPeerCategoryCorrespondents struct {
}

// TopPeerCategoryCorrespondentsTypeID is TL type id of TopPeerCategoryCorrespondents.
const TopPeerCategoryCorrespondentsTypeID = 0x637b7ed

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryCorrespondents) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryCorrespondents{}
)

func (t *TopPeerCategoryCorrespondents) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryCorrespondents) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryCorrespondents",
		ID:   TopPeerCategoryCorrespondentsTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryCorrespondents) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryCorrespondents#637b7ed as nil")
	}
	b.PutID(TopPeerCategoryCorrespondentsTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryCorrespondents) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryCorrespondents#637b7ed as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryCorrespondents) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryCorrespondents#637b7ed to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryCorrespondentsTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryCorrespondents#637b7ed: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryCorrespondents) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryCorrespondents#637b7ed to nil")
	}
	return nil
}

// TopPeerCategoryGroups represents TL type `topPeerCategoryGroups#bd17a14a`.
// Often-opened groups and supergroups
//
// See https://core.telegram.org/constructor/topPeerCategoryGroups for reference.
type TopPeerCategoryGroups struct {
}

// TopPeerCategoryGroupsTypeID is TL type id of TopPeerCategoryGroups.
const TopPeerCategoryGroupsTypeID = 0xbd17a14a

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryGroups) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryGroups{}
)

func (t *TopPeerCategoryGroups) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryGroups) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryGroups",
		ID:   TopPeerCategoryGroupsTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryGroups) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryGroups#bd17a14a as nil")
	}
	b.PutID(TopPeerCategoryGroupsTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryGroups) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryGroups#bd17a14a as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryGroups) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryGroups#bd17a14a to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryGroupsTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryGroups#bd17a14a: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryGroups) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryGroups#bd17a14a to nil")
	}
	return nil
}

// TopPeerCategoryChannels represents TL type `topPeerCategoryChannels#161d9628`.
// Most frequently visited channels
//
// See https://core.telegram.org/constructor/topPeerCategoryChannels for reference.
type TopPeerCategoryChannels struct {
}

// TopPeerCategoryChannelsTypeID is TL type id of TopPeerCategoryChannels.
const TopPeerCategoryChannelsTypeID = 0x161d9628

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryChannels) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryChannels{}
)

func (t *TopPeerCategoryChannels) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryChannels) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryChannels",
		ID:   TopPeerCategoryChannelsTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryChannels) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryChannels#161d9628 as nil")
	}
	b.PutID(TopPeerCategoryChannelsTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryChannels) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryChannels#161d9628 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryChannels) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryChannels#161d9628 to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryChannelsTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryChannels#161d9628: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryChannels) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryChannels#161d9628 to nil")
	}
	return nil
}

// TopPeerCategoryPhoneCalls represents TL type `topPeerCategoryPhoneCalls#1e76a78c`.
// Most frequently called users
//
// See https://core.telegram.org/constructor/topPeerCategoryPhoneCalls for reference.
type TopPeerCategoryPhoneCalls struct {
}

// TopPeerCategoryPhoneCallsTypeID is TL type id of TopPeerCategoryPhoneCalls.
const TopPeerCategoryPhoneCallsTypeID = 0x1e76a78c

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryPhoneCalls) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryPhoneCalls{}
)

func (t *TopPeerCategoryPhoneCalls) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryPhoneCalls) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryPhoneCalls",
		ID:   TopPeerCategoryPhoneCallsTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryPhoneCalls) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryPhoneCalls#1e76a78c as nil")
	}
	b.PutID(TopPeerCategoryPhoneCallsTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryPhoneCalls) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryPhoneCalls#1e76a78c as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryPhoneCalls) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryPhoneCalls#1e76a78c to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryPhoneCallsTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryPhoneCalls#1e76a78c: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryPhoneCalls) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryPhoneCalls#1e76a78c to nil")
	}
	return nil
}

// TopPeerCategoryForwardUsers represents TL type `topPeerCategoryForwardUsers#a8406ca9`.
// Users to which the users often forwards messages to
//
// See https://core.telegram.org/constructor/topPeerCategoryForwardUsers for reference.
type TopPeerCategoryForwardUsers struct {
}

// TopPeerCategoryForwardUsersTypeID is TL type id of TopPeerCategoryForwardUsers.
const TopPeerCategoryForwardUsersTypeID = 0xa8406ca9

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryForwardUsers) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryForwardUsers{}
)

func (t *TopPeerCategoryForwardUsers) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryForwardUsers) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryForwardUsers",
		ID:   TopPeerCategoryForwardUsersTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryForwardUsers) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryForwardUsers#a8406ca9 as nil")
	}
	b.PutID(TopPeerCategoryForwardUsersTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryForwardUsers) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryForwardUsers#a8406ca9 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryForwardUsers) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryForwardUsers#a8406ca9 to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryForwardUsersTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryForwardUsers#a8406ca9: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryForwardUsers) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryForwardUsers#a8406ca9 to nil")
	}
	return nil
}

// TopPeerCategoryForwardChats represents TL type `topPeerCategoryForwardChats#fbeec0f0`.
// Chats to which the users often forwards messages to
//
// See https://core.telegram.org/constructor/topPeerCategoryForwardChats for reference.
type TopPeerCategoryForwardChats struct {
}

// TopPeerCategoryForwardChatsTypeID is TL type id of TopPeerCategoryForwardChats.
const TopPeerCategoryForwardChatsTypeID = 0xfbeec0f0

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryForwardChats) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryForwardChats{}
)

func (t *TopPeerCategoryForwardChats) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryForwardChats) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryForwardChats",
		ID:   TopPeerCategoryForwardChatsTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryForwardChats) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryForwardChats#fbeec0f0 as nil")
	}
	b.PutID(TopPeerCategoryForwardChatsTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryForwardChats) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryForwardChats#fbeec0f0 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryForwardChats) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryForwardChats#fbeec0f0 to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryForwardChatsTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryForwardChats#fbeec0f0: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryForwardChats) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryForwardChats#fbeec0f0 to nil")
	}
	return nil
}

// TopPeerCategoryBotsApp represents TL type `topPeerCategoryBotsApp#fd9e7bec`.
// Most frequently used Main Mini Bot Apps¹.
//
// Links:
//  1. https://core.telegram.org/api/bots/webapps#main-mini-apps
//
// See https://core.telegram.org/constructor/topPeerCategoryBotsApp for reference.
type TopPeerCategoryBotsApp struct {
}

// TopPeerCategoryBotsAppTypeID is TL type id of TopPeerCategoryBotsApp.
const TopPeerCategoryBotsAppTypeID = 0xfd9e7bec

// construct implements constructor of TopPeerCategoryClass.
func (t TopPeerCategoryBotsApp) construct() TopPeerCategoryClass { return &t }

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

	_ TopPeerCategoryClass = &TopPeerCategoryBotsApp{}
)

func (t *TopPeerCategoryBotsApp) Zero() bool {
	if t == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (t *TopPeerCategoryBotsApp) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "topPeerCategoryBotsApp",
		ID:   TopPeerCategoryBotsAppTypeID,
	}
	if t == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (t *TopPeerCategoryBotsApp) Encode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryBotsApp#fd9e7bec as nil")
	}
	b.PutID(TopPeerCategoryBotsAppTypeID)
	return t.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (t *TopPeerCategoryBotsApp) EncodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't encode topPeerCategoryBotsApp#fd9e7bec as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (t *TopPeerCategoryBotsApp) Decode(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryBotsApp#fd9e7bec to nil")
	}
	if err := b.ConsumeID(TopPeerCategoryBotsAppTypeID); err != nil {
		return fmt.Errorf("unable to decode topPeerCategoryBotsApp#fd9e7bec: %w", err)
	}
	return t.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (t *TopPeerCategoryBotsApp) DecodeBare(b *bin.Buffer) error {
	if t == nil {
		return fmt.Errorf("can't decode topPeerCategoryBotsApp#fd9e7bec to nil")
	}
	return nil
}

// TopPeerCategoryClassName is schema name of TopPeerCategoryClass.
const TopPeerCategoryClassName = "TopPeerCategory"

// TopPeerCategoryClass represents TopPeerCategory generic type.
//
// See https://core.telegram.org/type/TopPeerCategory for reference.
//
// Example:
//
//	g, err := tg.DecodeTopPeerCategory(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.TopPeerCategoryBotsPM: // topPeerCategoryBotsPM#ab661b5b
//	case *tg.TopPeerCategoryBotsInline: // topPeerCategoryBotsInline#148677e2
//	case *tg.TopPeerCategoryCorrespondents: // topPeerCategoryCorrespondents#637b7ed
//	case *tg.TopPeerCategoryGroups: // topPeerCategoryGroups#bd17a14a
//	case *tg.TopPeerCategoryChannels: // topPeerCategoryChannels#161d9628
//	case *tg.TopPeerCategoryPhoneCalls: // topPeerCategoryPhoneCalls#1e76a78c
//	case *tg.TopPeerCategoryForwardUsers: // topPeerCategoryForwardUsers#a8406ca9
//	case *tg.TopPeerCategoryForwardChats: // topPeerCategoryForwardChats#fbeec0f0
//	case *tg.TopPeerCategoryBotsApp: // topPeerCategoryBotsApp#fd9e7bec
//	default: panic(v)
//	}
type TopPeerCategoryClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() TopPeerCategoryClass

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

// DecodeTopPeerCategory implements binary de-serialization for TopPeerCategoryClass.
func DecodeTopPeerCategory(buf *bin.Buffer) (TopPeerCategoryClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case TopPeerCategoryBotsPMTypeID:
		// Decoding topPeerCategoryBotsPM#ab661b5b.
		v := TopPeerCategoryBotsPM{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	case TopPeerCategoryBotsInlineTypeID:
		// Decoding topPeerCategoryBotsInline#148677e2.
		v := TopPeerCategoryBotsInline{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	case TopPeerCategoryCorrespondentsTypeID:
		// Decoding topPeerCategoryCorrespondents#637b7ed.
		v := TopPeerCategoryCorrespondents{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	case TopPeerCategoryGroupsTypeID:
		// Decoding topPeerCategoryGroups#bd17a14a.
		v := TopPeerCategoryGroups{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	case TopPeerCategoryChannelsTypeID:
		// Decoding topPeerCategoryChannels#161d9628.
		v := TopPeerCategoryChannels{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	case TopPeerCategoryPhoneCallsTypeID:
		// Decoding topPeerCategoryPhoneCalls#1e76a78c.
		v := TopPeerCategoryPhoneCalls{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	case TopPeerCategoryForwardUsersTypeID:
		// Decoding topPeerCategoryForwardUsers#a8406ca9.
		v := TopPeerCategoryForwardUsers{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	case TopPeerCategoryForwardChatsTypeID:
		// Decoding topPeerCategoryForwardChats#fbeec0f0.
		v := TopPeerCategoryForwardChats{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	case TopPeerCategoryBotsAppTypeID:
		// Decoding topPeerCategoryBotsApp#fd9e7bec.
		v := TopPeerCategoryBotsApp{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode TopPeerCategoryClass: %w", bin.NewUnexpectedID(id))
	}
}

// TopPeerCategory boxes the TopPeerCategoryClass providing a helper.
type TopPeerCategoryBox struct {
	TopPeerCategory TopPeerCategoryClass
}

// Decode implements bin.Decoder for TopPeerCategoryBox.
func (b *TopPeerCategoryBox) Decode(buf *bin.Buffer) error {
	if b == nil {
		return fmt.Errorf("unable to decode TopPeerCategoryBox to nil")
	}
	v, err := DecodeTopPeerCategory(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.TopPeerCategory = v
	return nil
}

// Encode implements bin.Encode for TopPeerCategoryBox.
func (b *TopPeerCategoryBox) Encode(buf *bin.Buffer) error {
	if b == nil || b.TopPeerCategory == nil {
		return fmt.Errorf("unable to encode TopPeerCategoryClass as nil")
	}
	return b.TopPeerCategory.Encode(buf)
}
