// Code generated by gotdgen, DO NOT EDIT.

package tdapi

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

// InternalLinkTypeActiveSessions represents TL type `internalLinkTypeActiveSessions#706bbbad`.
type InternalLinkTypeActiveSessions struct {
}

// InternalLinkTypeActiveSessionsTypeID is TL type id of InternalLinkTypeActiveSessions.
const InternalLinkTypeActiveSessionsTypeID = 0x706bbbad

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeActiveSessions) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeActiveSessions{}
)

func (i *InternalLinkTypeActiveSessions) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeActiveSessions) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeActiveSessions#706bbbad as nil")
	}
	b.PutID(InternalLinkTypeActiveSessionsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeActiveSessions) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeActiveSessions#706bbbad as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeActiveSessions) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeActiveSessions#706bbbad to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeActiveSessionsTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeActiveSessions#706bbbad: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeActiveSessions) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeActiveSessions#706bbbad to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeActiveSessions) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeActiveSessions#706bbbad as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeActiveSessions")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeActiveSessions) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeActiveSessions#706bbbad to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeActiveSessions"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeActiveSessions#706bbbad: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeAttachmentMenuBot represents TL type `internalLinkTypeAttachmentMenuBot#644c4225`.
type InternalLinkTypeAttachmentMenuBot struct {
	// Target chat to be opened
	TargetChat TargetChatClass
	// Username of the bot
	BotUsername string
	// URL to be passed to openWebApp
	URL string
}

// InternalLinkTypeAttachmentMenuBotTypeID is TL type id of InternalLinkTypeAttachmentMenuBot.
const InternalLinkTypeAttachmentMenuBotTypeID = 0x644c4225

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeAttachmentMenuBot) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeAttachmentMenuBot{}
)

func (i *InternalLinkTypeAttachmentMenuBot) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.TargetChat == nil) {
		return false
	}
	if !(i.BotUsername == "") {
		return false
	}
	if !(i.URL == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeAttachmentMenuBot) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeAttachmentMenuBot",
		ID:   InternalLinkTypeAttachmentMenuBotTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "TargetChat",
			SchemaName: "target_chat",
		},
		{
			Name:       "BotUsername",
			SchemaName: "bot_username",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeAttachmentMenuBot) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeAttachmentMenuBot#644c4225 as nil")
	}
	b.PutID(InternalLinkTypeAttachmentMenuBotTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeAttachmentMenuBot) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeAttachmentMenuBot#644c4225 as nil")
	}
	if i.TargetChat == nil {
		return fmt.Errorf("unable to encode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat is nil")
	}
	if err := i.TargetChat.Encode(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat: %w", err)
	}
	b.PutString(i.BotUsername)
	b.PutString(i.URL)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeAttachmentMenuBot) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeAttachmentMenuBot#644c4225 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeAttachmentMenuBotTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeAttachmentMenuBot) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeAttachmentMenuBot#644c4225 to nil")
	}
	{
		value, err := DecodeTargetChat(b)
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat: %w", err)
		}
		i.TargetChat = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field bot_username: %w", err)
		}
		i.BotUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field url: %w", err)
		}
		i.URL = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeAttachmentMenuBot) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeAttachmentMenuBot#644c4225 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeAttachmentMenuBot")
	b.Comma()
	b.FieldStart("target_chat")
	if i.TargetChat == nil {
		return fmt.Errorf("unable to encode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat is nil")
	}
	if err := i.TargetChat.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat: %w", err)
	}
	b.Comma()
	b.FieldStart("bot_username")
	b.PutString(i.BotUsername)
	b.Comma()
	b.FieldStart("url")
	b.PutString(i.URL)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeAttachmentMenuBot) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeAttachmentMenuBot#644c4225 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeAttachmentMenuBot"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: %w", err)
			}
		case "target_chat":
			value, err := DecodeTDLibJSONTargetChat(b)
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat: %w", err)
			}
			i.TargetChat = value
		case "bot_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field bot_username: %w", err)
			}
			i.BotUsername = value
		case "url":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field url: %w", err)
			}
			i.URL = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetTargetChat returns value of TargetChat field.
func (i *InternalLinkTypeAttachmentMenuBot) GetTargetChat() (value TargetChatClass) {
	if i == nil {
		return
	}
	return i.TargetChat
}

// GetBotUsername returns value of BotUsername field.
func (i *InternalLinkTypeAttachmentMenuBot) GetBotUsername() (value string) {
	if i == nil {
		return
	}
	return i.BotUsername
}

// GetURL returns value of URL field.
func (i *InternalLinkTypeAttachmentMenuBot) GetURL() (value string) {
	if i == nil {
		return
	}
	return i.URL
}

// InternalLinkTypeAuthenticationCode represents TL type `internalLinkTypeAuthenticationCode#f3874ff2`.
type InternalLinkTypeAuthenticationCode struct {
	// The authentication code
	Code string
}

// InternalLinkTypeAuthenticationCodeTypeID is TL type id of InternalLinkTypeAuthenticationCode.
const InternalLinkTypeAuthenticationCodeTypeID = 0xf3874ff2

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeAuthenticationCode) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeAuthenticationCode{}
)

func (i *InternalLinkTypeAuthenticationCode) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Code == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeAuthenticationCode) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeAuthenticationCode",
		ID:   InternalLinkTypeAuthenticationCodeTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Code",
			SchemaName: "code",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeAuthenticationCode) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeAuthenticationCode#f3874ff2 as nil")
	}
	b.PutID(InternalLinkTypeAuthenticationCodeTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeAuthenticationCode) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeAuthenticationCode#f3874ff2 as nil")
	}
	b.PutString(i.Code)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeAuthenticationCode) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeAuthenticationCode#f3874ff2 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeAuthenticationCode#f3874ff2: field code: %w", err)
		}
		i.Code = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeAuthenticationCode) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeAuthenticationCode#f3874ff2 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeAuthenticationCode")
	b.Comma()
	b.FieldStart("code")
	b.PutString(i.Code)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeAuthenticationCode) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeAuthenticationCode#f3874ff2 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeAuthenticationCode"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeAuthenticationCode#f3874ff2: %w", err)
			}
		case "code":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeAuthenticationCode#f3874ff2: field code: %w", err)
			}
			i.Code = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetCode returns value of Code field.
func (i *InternalLinkTypeAuthenticationCode) GetCode() (value string) {
	if i == nil {
		return
	}
	return i.Code
}

// InternalLinkTypeBackground represents TL type `internalLinkTypeBackground#b0d2908`.
type InternalLinkTypeBackground struct {
	// Name of the background
	BackgroundName string
}

// InternalLinkTypeBackgroundTypeID is TL type id of InternalLinkTypeBackground.
const InternalLinkTypeBackgroundTypeID = 0xb0d2908

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeBackground) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeBackground{}
)

func (i *InternalLinkTypeBackground) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.BackgroundName == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeBackground) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeBackground",
		ID:   InternalLinkTypeBackgroundTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "BackgroundName",
			SchemaName: "background_name",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeBackground) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBackground#b0d2908 as nil")
	}
	b.PutID(InternalLinkTypeBackgroundTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeBackground) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBackground#b0d2908 as nil")
	}
	b.PutString(i.BackgroundName)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeBackground) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBackground#b0d2908 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBackground#b0d2908: field background_name: %w", err)
		}
		i.BackgroundName = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeBackground) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBackground#b0d2908 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeBackground")
	b.Comma()
	b.FieldStart("background_name")
	b.PutString(i.BackgroundName)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeBackground) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBackground#b0d2908 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeBackground"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBackground#b0d2908: %w", err)
			}
		case "background_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBackground#b0d2908: field background_name: %w", err)
			}
			i.BackgroundName = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetBackgroundName returns value of BackgroundName field.
func (i *InternalLinkTypeBackground) GetBackgroundName() (value string) {
	if i == nil {
		return
	}
	return i.BackgroundName
}

// InternalLinkTypeBotAddToChannel represents TL type `internalLinkTypeBotAddToChannel#538ac2c0`.
type InternalLinkTypeBotAddToChannel struct {
	// Username of the bot
	BotUsername string
	// Expected administrator rights for the bot
	AdministratorRights ChatAdministratorRights
}

// InternalLinkTypeBotAddToChannelTypeID is TL type id of InternalLinkTypeBotAddToChannel.
const InternalLinkTypeBotAddToChannelTypeID = 0x538ac2c0

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeBotAddToChannel) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeBotAddToChannel{}
)

func (i *InternalLinkTypeBotAddToChannel) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.BotUsername == "") {
		return false
	}
	if !(i.AdministratorRights.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeBotAddToChannel) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeBotAddToChannel",
		ID:   InternalLinkTypeBotAddToChannelTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "BotUsername",
			SchemaName: "bot_username",
		},
		{
			Name:       "AdministratorRights",
			SchemaName: "administrator_rights",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeBotAddToChannel) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotAddToChannel#538ac2c0 as nil")
	}
	b.PutID(InternalLinkTypeBotAddToChannelTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeBotAddToChannel) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotAddToChannel#538ac2c0 as nil")
	}
	b.PutString(i.BotUsername)
	if err := i.AdministratorRights.Encode(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeBotAddToChannel#538ac2c0: field administrator_rights: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeBotAddToChannel) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBotAddToChannel#538ac2c0 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeBotAddToChannelTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeBotAddToChannel) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBotAddToChannel#538ac2c0 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: field bot_username: %w", err)
		}
		i.BotUsername = value
	}
	{
		if err := i.AdministratorRights.Decode(b); err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: field administrator_rights: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeBotAddToChannel) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotAddToChannel#538ac2c0 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeBotAddToChannel")
	b.Comma()
	b.FieldStart("bot_username")
	b.PutString(i.BotUsername)
	b.Comma()
	b.FieldStart("administrator_rights")
	if err := i.AdministratorRights.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeBotAddToChannel#538ac2c0: field administrator_rights: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeBotAddToChannel) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBotAddToChannel#538ac2c0 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeBotAddToChannel"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: %w", err)
			}
		case "bot_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: field bot_username: %w", err)
			}
			i.BotUsername = value
		case "administrator_rights":
			if err := i.AdministratorRights.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: field administrator_rights: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetBotUsername returns value of BotUsername field.
func (i *InternalLinkTypeBotAddToChannel) GetBotUsername() (value string) {
	if i == nil {
		return
	}
	return i.BotUsername
}

// GetAdministratorRights returns value of AdministratorRights field.
func (i *InternalLinkTypeBotAddToChannel) GetAdministratorRights() (value ChatAdministratorRights) {
	if i == nil {
		return
	}
	return i.AdministratorRights
}

// InternalLinkTypeBotStart represents TL type `internalLinkTypeBotStart#3f985fed`.
type InternalLinkTypeBotStart struct {
	// Username of the bot
	BotUsername string
	// The parameter to be passed to sendBotStartMessage
	StartParameter string
	// True, if sendBotStartMessage must be called automatically without showing the START
	// button
	Autostart bool
}

// InternalLinkTypeBotStartTypeID is TL type id of InternalLinkTypeBotStart.
const InternalLinkTypeBotStartTypeID = 0x3f985fed

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeBotStart) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeBotStart{}
)

func (i *InternalLinkTypeBotStart) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.BotUsername == "") {
		return false
	}
	if !(i.StartParameter == "") {
		return false
	}
	if !(i.Autostart == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeBotStart) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeBotStart",
		ID:   InternalLinkTypeBotStartTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "BotUsername",
			SchemaName: "bot_username",
		},
		{
			Name:       "StartParameter",
			SchemaName: "start_parameter",
		},
		{
			Name:       "Autostart",
			SchemaName: "autostart",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeBotStart) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotStart#3f985fed as nil")
	}
	b.PutID(InternalLinkTypeBotStartTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeBotStart) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotStart#3f985fed as nil")
	}
	b.PutString(i.BotUsername)
	b.PutString(i.StartParameter)
	b.PutBool(i.Autostart)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeBotStart) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBotStart#3f985fed to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeBotStartTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeBotStart) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBotStart#3f985fed to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field bot_username: %w", err)
		}
		i.BotUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field start_parameter: %w", err)
		}
		i.StartParameter = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field autostart: %w", err)
		}
		i.Autostart = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeBotStart) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotStart#3f985fed as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeBotStart")
	b.Comma()
	b.FieldStart("bot_username")
	b.PutString(i.BotUsername)
	b.Comma()
	b.FieldStart("start_parameter")
	b.PutString(i.StartParameter)
	b.Comma()
	b.FieldStart("autostart")
	b.PutBool(i.Autostart)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeBotStart) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBotStart#3f985fed to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeBotStart"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: %w", err)
			}
		case "bot_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field bot_username: %w", err)
			}
			i.BotUsername = value
		case "start_parameter":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field start_parameter: %w", err)
			}
			i.StartParameter = value
		case "autostart":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field autostart: %w", err)
			}
			i.Autostart = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetBotUsername returns value of BotUsername field.
func (i *InternalLinkTypeBotStart) GetBotUsername() (value string) {
	if i == nil {
		return
	}
	return i.BotUsername
}

// GetStartParameter returns value of StartParameter field.
func (i *InternalLinkTypeBotStart) GetStartParameter() (value string) {
	if i == nil {
		return
	}
	return i.StartParameter
}

// GetAutostart returns value of Autostart field.
func (i *InternalLinkTypeBotStart) GetAutostart() (value bool) {
	if i == nil {
		return
	}
	return i.Autostart
}

// InternalLinkTypeBotStartInGroup represents TL type `internalLinkTypeBotStartInGroup#ca0d8cce`.
type InternalLinkTypeBotStartInGroup struct {
	// Username of the bot
	BotUsername string
	// The parameter to be passed to sendBotStartMessage
	StartParameter string
	// Expected administrator rights for the bot; may be null
	AdministratorRights ChatAdministratorRights
}

// InternalLinkTypeBotStartInGroupTypeID is TL type id of InternalLinkTypeBotStartInGroup.
const InternalLinkTypeBotStartInGroupTypeID = 0xca0d8cce

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeBotStartInGroup) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeBotStartInGroup{}
)

func (i *InternalLinkTypeBotStartInGroup) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.BotUsername == "") {
		return false
	}
	if !(i.StartParameter == "") {
		return false
	}
	if !(i.AdministratorRights.Zero()) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeBotStartInGroup) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeBotStartInGroup",
		ID:   InternalLinkTypeBotStartInGroupTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "BotUsername",
			SchemaName: "bot_username",
		},
		{
			Name:       "StartParameter",
			SchemaName: "start_parameter",
		},
		{
			Name:       "AdministratorRights",
			SchemaName: "administrator_rights",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeBotStartInGroup) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotStartInGroup#ca0d8cce as nil")
	}
	b.PutID(InternalLinkTypeBotStartInGroupTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeBotStartInGroup) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotStartInGroup#ca0d8cce as nil")
	}
	b.PutString(i.BotUsername)
	b.PutString(i.StartParameter)
	if err := i.AdministratorRights.Encode(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeBotStartInGroup#ca0d8cce: field administrator_rights: %w", err)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeBotStartInGroup) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBotStartInGroup#ca0d8cce to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field bot_username: %w", err)
		}
		i.BotUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field start_parameter: %w", err)
		}
		i.StartParameter = value
	}
	{
		if err := i.AdministratorRights.Decode(b); err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field administrator_rights: %w", err)
		}
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeBotStartInGroup) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBotStartInGroup#ca0d8cce as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeBotStartInGroup")
	b.Comma()
	b.FieldStart("bot_username")
	b.PutString(i.BotUsername)
	b.Comma()
	b.FieldStart("start_parameter")
	b.PutString(i.StartParameter)
	b.Comma()
	b.FieldStart("administrator_rights")
	if err := i.AdministratorRights.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeBotStartInGroup#ca0d8cce: field administrator_rights: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeBotStartInGroup) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBotStartInGroup#ca0d8cce to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeBotStartInGroup"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: %w", err)
			}
		case "bot_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field bot_username: %w", err)
			}
			i.BotUsername = value
		case "start_parameter":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field start_parameter: %w", err)
			}
			i.StartParameter = value
		case "administrator_rights":
			if err := i.AdministratorRights.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field administrator_rights: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetBotUsername returns value of BotUsername field.
func (i *InternalLinkTypeBotStartInGroup) GetBotUsername() (value string) {
	if i == nil {
		return
	}
	return i.BotUsername
}

// GetStartParameter returns value of StartParameter field.
func (i *InternalLinkTypeBotStartInGroup) GetStartParameter() (value string) {
	if i == nil {
		return
	}
	return i.StartParameter
}

// GetAdministratorRights returns value of AdministratorRights field.
func (i *InternalLinkTypeBotStartInGroup) GetAdministratorRights() (value ChatAdministratorRights) {
	if i == nil {
		return
	}
	return i.AdministratorRights
}

// InternalLinkTypeBusinessChat represents TL type `internalLinkTypeBusinessChat#a03ae9d7`.
type InternalLinkTypeBusinessChat struct {
	// Name of the link
	LinkName string
}

// InternalLinkTypeBusinessChatTypeID is TL type id of InternalLinkTypeBusinessChat.
const InternalLinkTypeBusinessChatTypeID = 0xa03ae9d7

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeBusinessChat) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeBusinessChat{}
)

func (i *InternalLinkTypeBusinessChat) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.LinkName == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeBusinessChat) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeBusinessChat",
		ID:   InternalLinkTypeBusinessChatTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "LinkName",
			SchemaName: "link_name",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeBusinessChat) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBusinessChat#a03ae9d7 as nil")
	}
	b.PutID(InternalLinkTypeBusinessChatTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeBusinessChat) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBusinessChat#a03ae9d7 as nil")
	}
	b.PutString(i.LinkName)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeBusinessChat) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBusinessChat#a03ae9d7 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBusinessChat#a03ae9d7: field link_name: %w", err)
		}
		i.LinkName = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeBusinessChat) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBusinessChat#a03ae9d7 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeBusinessChat")
	b.Comma()
	b.FieldStart("link_name")
	b.PutString(i.LinkName)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeBusinessChat) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBusinessChat#a03ae9d7 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeBusinessChat"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBusinessChat#a03ae9d7: %w", err)
			}
		case "link_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBusinessChat#a03ae9d7: field link_name: %w", err)
			}
			i.LinkName = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetLinkName returns value of LinkName field.
func (i *InternalLinkTypeBusinessChat) GetLinkName() (value string) {
	if i == nil {
		return
	}
	return i.LinkName
}

// InternalLinkTypeBuyStars represents TL type `internalLinkTypeBuyStars#a94cc347`.
type InternalLinkTypeBuyStars struct {
	// The number of Telegram Stars that must be owned by the user
	StarCount int64
	// Purpose of Telegram Star purchase. Arbitrary string specified by the server, for
	// example, "subs" if the Telegram Stars are required to extend channel subscriptions
	Purpose string
}

// InternalLinkTypeBuyStarsTypeID is TL type id of InternalLinkTypeBuyStars.
const InternalLinkTypeBuyStarsTypeID = 0xa94cc347

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeBuyStars) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeBuyStars{}
)

func (i *InternalLinkTypeBuyStars) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.StarCount == 0) {
		return false
	}
	if !(i.Purpose == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeBuyStars) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeBuyStars",
		ID:   InternalLinkTypeBuyStarsTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "StarCount",
			SchemaName: "star_count",
		},
		{
			Name:       "Purpose",
			SchemaName: "purpose",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeBuyStars) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBuyStars#a94cc347 as nil")
	}
	b.PutID(InternalLinkTypeBuyStarsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeBuyStars) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBuyStars#a94cc347 as nil")
	}
	b.PutInt53(i.StarCount)
	b.PutString(i.Purpose)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeBuyStars) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBuyStars#a94cc347 to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: field star_count: %w", err)
		}
		i.StarCount = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: field purpose: %w", err)
		}
		i.Purpose = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeBuyStars) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeBuyStars#a94cc347 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeBuyStars")
	b.Comma()
	b.FieldStart("star_count")
	b.PutInt53(i.StarCount)
	b.Comma()
	b.FieldStart("purpose")
	b.PutString(i.Purpose)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeBuyStars) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeBuyStars#a94cc347 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeBuyStars"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: %w", err)
			}
		case "star_count":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: field star_count: %w", err)
			}
			i.StarCount = value
		case "purpose":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: field purpose: %w", err)
			}
			i.Purpose = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetStarCount returns value of StarCount field.
func (i *InternalLinkTypeBuyStars) GetStarCount() (value int64) {
	if i == nil {
		return
	}
	return i.StarCount
}

// GetPurpose returns value of Purpose field.
func (i *InternalLinkTypeBuyStars) GetPurpose() (value string) {
	if i == nil {
		return
	}
	return i.Purpose
}

// InternalLinkTypeChangePhoneNumber represents TL type `internalLinkTypeChangePhoneNumber#f0275b01`.
type InternalLinkTypeChangePhoneNumber struct {
}

// InternalLinkTypeChangePhoneNumberTypeID is TL type id of InternalLinkTypeChangePhoneNumber.
const InternalLinkTypeChangePhoneNumberTypeID = 0xf0275b01

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeChangePhoneNumber) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeChangePhoneNumber{}
)

func (i *InternalLinkTypeChangePhoneNumber) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeChangePhoneNumber) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChangePhoneNumber#f0275b01 as nil")
	}
	b.PutID(InternalLinkTypeChangePhoneNumberTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeChangePhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChangePhoneNumber#f0275b01 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeChangePhoneNumber")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeChangePhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChangePhoneNumber#f0275b01 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeChangePhoneNumber"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChangePhoneNumber#f0275b01: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeChatAffiliateProgram represents TL type `internalLinkTypeChatAffiliateProgram#25ac5024`.
type InternalLinkTypeChatAffiliateProgram struct {
	// Username to be passed to searchChatAffiliateProgram
	Username string
	// Referrer to be passed to searchChatAffiliateProgram
	Referrer string
}

// InternalLinkTypeChatAffiliateProgramTypeID is TL type id of InternalLinkTypeChatAffiliateProgram.
const InternalLinkTypeChatAffiliateProgramTypeID = 0x25ac5024

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeChatAffiliateProgram) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeChatAffiliateProgram{}
)

func (i *InternalLinkTypeChatAffiliateProgram) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Username == "") {
		return false
	}
	if !(i.Referrer == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeChatAffiliateProgram) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeChatAffiliateProgram",
		ID:   InternalLinkTypeChatAffiliateProgramTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Username",
			SchemaName: "username",
		},
		{
			Name:       "Referrer",
			SchemaName: "referrer",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeChatAffiliateProgram) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatAffiliateProgram#25ac5024 as nil")
	}
	b.PutID(InternalLinkTypeChatAffiliateProgramTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeChatAffiliateProgram) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatAffiliateProgram#25ac5024 as nil")
	}
	b.PutString(i.Username)
	b.PutString(i.Referrer)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeChatAffiliateProgram) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatAffiliateProgram#25ac5024 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeChatAffiliateProgramTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeChatAffiliateProgram) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatAffiliateProgram#25ac5024 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: field username: %w", err)
		}
		i.Username = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: field referrer: %w", err)
		}
		i.Referrer = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeChatAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatAffiliateProgram#25ac5024 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeChatAffiliateProgram")
	b.Comma()
	b.FieldStart("username")
	b.PutString(i.Username)
	b.Comma()
	b.FieldStart("referrer")
	b.PutString(i.Referrer)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeChatAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatAffiliateProgram#25ac5024 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeChatAffiliateProgram"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: %w", err)
			}
		case "username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: field username: %w", err)
			}
			i.Username = value
		case "referrer":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: field referrer: %w", err)
			}
			i.Referrer = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetUsername returns value of Username field.
func (i *InternalLinkTypeChatAffiliateProgram) GetUsername() (value string) {
	if i == nil {
		return
	}
	return i.Username
}

// GetReferrer returns value of Referrer field.
func (i *InternalLinkTypeChatAffiliateProgram) GetReferrer() (value string) {
	if i == nil {
		return
	}
	return i.Referrer
}

// InternalLinkTypeChatBoost represents TL type `internalLinkTypeChatBoost#d549fd40`.
type InternalLinkTypeChatBoost struct {
	// URL to be passed to getChatBoostLinkInfo
	URL string
}

// InternalLinkTypeChatBoostTypeID is TL type id of InternalLinkTypeChatBoost.
const InternalLinkTypeChatBoostTypeID = 0xd549fd40

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeChatBoost) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeChatBoost{}
)

func (i *InternalLinkTypeChatBoost) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.URL == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeChatBoost) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeChatBoost",
		ID:   InternalLinkTypeChatBoostTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeChatBoost) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil")
	}
	b.PutID(InternalLinkTypeChatBoostTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeChatBoost) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil")
	}
	b.PutString(i.URL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeChatBoost) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatBoost#d549fd40 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: field url: %w", err)
		}
		i.URL = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeChatBoost")
	b.Comma()
	b.FieldStart("url")
	b.PutString(i.URL)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatBoost#d549fd40 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeChatBoost"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: %w", err)
			}
		case "url":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: field url: %w", err)
			}
			i.URL = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetURL returns value of URL field.
func (i *InternalLinkTypeChatBoost) GetURL() (value string) {
	if i == nil {
		return
	}
	return i.URL
}

// InternalLinkTypeChatFolderInvite represents TL type `internalLinkTypeChatFolderInvite#89b2493e`.
type InternalLinkTypeChatFolderInvite struct {
	// Internal representation of the invite link
	InviteLink string
}

// InternalLinkTypeChatFolderInviteTypeID is TL type id of InternalLinkTypeChatFolderInvite.
const InternalLinkTypeChatFolderInviteTypeID = 0x89b2493e

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeChatFolderInvite) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeChatFolderInvite{}
)

func (i *InternalLinkTypeChatFolderInvite) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.InviteLink == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeChatFolderInvite) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeChatFolderInvite",
		ID:   InternalLinkTypeChatFolderInviteTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "InviteLink",
			SchemaName: "invite_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeChatFolderInvite) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatFolderInvite#89b2493e as nil")
	}
	b.PutID(InternalLinkTypeChatFolderInviteTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeChatFolderInvite) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatFolderInvite#89b2493e as nil")
	}
	b.PutString(i.InviteLink)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeChatFolderInvite) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatFolderInvite#89b2493e to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeChatFolderInviteTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeChatFolderInvite#89b2493e: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeChatFolderInvite) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatFolderInvite#89b2493e to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeChatFolderInvite#89b2493e: field invite_link: %w", err)
		}
		i.InviteLink = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeChatFolderInvite) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatFolderInvite#89b2493e as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeChatFolderInvite")
	b.Comma()
	b.FieldStart("invite_link")
	b.PutString(i.InviteLink)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeChatFolderInvite) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatFolderInvite#89b2493e to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeChatFolderInvite"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatFolderInvite#89b2493e: %w", err)
			}
		case "invite_link":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatFolderInvite#89b2493e: field invite_link: %w", err)
			}
			i.InviteLink = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetInviteLink returns value of InviteLink field.
func (i *InternalLinkTypeChatFolderInvite) GetInviteLink() (value string) {
	if i == nil {
		return
	}
	return i.InviteLink
}

// InternalLinkTypeChatFolderSettings represents TL type `internalLinkTypeChatFolderSettings#bfff055c`.
type InternalLinkTypeChatFolderSettings struct {
}

// InternalLinkTypeChatFolderSettingsTypeID is TL type id of InternalLinkTypeChatFolderSettings.
const InternalLinkTypeChatFolderSettingsTypeID = 0xbfff055c

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeChatFolderSettings) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeChatFolderSettings{}
)

func (i *InternalLinkTypeChatFolderSettings) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeChatFolderSettings) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatFolderSettings#bfff055c as nil")
	}
	b.PutID(InternalLinkTypeChatFolderSettingsTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeChatFolderSettings) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatFolderSettings#bfff055c as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeChatFolderSettings")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeChatFolderSettings) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatFolderSettings#bfff055c to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeChatFolderSettings"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatFolderSettings#bfff055c: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeChatInvite represents TL type `internalLinkTypeChatInvite#198c3cd9`.
type InternalLinkTypeChatInvite struct {
	// Internal representation of the invite link
	InviteLink string
}

// InternalLinkTypeChatInviteTypeID is TL type id of InternalLinkTypeChatInvite.
const InternalLinkTypeChatInviteTypeID = 0x198c3cd9

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeChatInvite) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeChatInvite{}
)

func (i *InternalLinkTypeChatInvite) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.InviteLink == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeChatInvite) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeChatInvite",
		ID:   InternalLinkTypeChatInviteTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "InviteLink",
			SchemaName: "invite_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeChatInvite) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatInvite#198c3cd9 as nil")
	}
	b.PutID(InternalLinkTypeChatInviteTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeChatInvite) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatInvite#198c3cd9 as nil")
	}
	b.PutString(i.InviteLink)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeChatInvite) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatInvite#198c3cd9 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeChatInviteTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeChatInvite#198c3cd9: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeChatInvite) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatInvite#198c3cd9 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeChatInvite#198c3cd9: field invite_link: %w", err)
		}
		i.InviteLink = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeChatInvite) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeChatInvite#198c3cd9 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeChatInvite")
	b.Comma()
	b.FieldStart("invite_link")
	b.PutString(i.InviteLink)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeChatInvite) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeChatInvite#198c3cd9 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeChatInvite"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatInvite#198c3cd9: %w", err)
			}
		case "invite_link":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeChatInvite#198c3cd9: field invite_link: %w", err)
			}
			i.InviteLink = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetInviteLink returns value of InviteLink field.
func (i *InternalLinkTypeChatInvite) GetInviteLink() (value string) {
	if i == nil {
		return
	}
	return i.InviteLink
}

// InternalLinkTypeDefaultMessageAutoDeleteTimerSettings represents TL type `internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931`.
type InternalLinkTypeDefaultMessageAutoDeleteTimerSettings struct {
}

// InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID is TL type id of InternalLinkTypeDefaultMessageAutoDeleteTimerSettings.
const InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID = 0x2baaf931

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) construct() InternalLinkTypeClass {
	return &i
}

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

	_ InternalLinkTypeClass = &InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{}
)

func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 as nil")
	}
	b.PutID(InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeDefaultMessageAutoDeleteTimerSettings")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeDefaultMessageAutoDeleteTimerSettings"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeEditProfileSettings represents TL type `internalLinkTypeEditProfileSettings#c30e5066`.
type InternalLinkTypeEditProfileSettings struct {
}

// InternalLinkTypeEditProfileSettingsTypeID is TL type id of InternalLinkTypeEditProfileSettings.
const InternalLinkTypeEditProfileSettingsTypeID = 0xc30e5066

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeEditProfileSettings) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeEditProfileSettings{}
)

func (i *InternalLinkTypeEditProfileSettings) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeEditProfileSettings) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeEditProfileSettings#c30e5066 as nil")
	}
	b.PutID(InternalLinkTypeEditProfileSettingsTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeEditProfileSettings) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeEditProfileSettings#c30e5066 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeEditProfileSettings")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeEditProfileSettings) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeEditProfileSettings#c30e5066 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeEditProfileSettings"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeEditProfileSettings#c30e5066: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeGame represents TL type `internalLinkTypeGame#f074adcd`.
type InternalLinkTypeGame struct {
	// Username of the bot that owns the game
	BotUsername string
	// Short name of the game
	GameShortName string
}

// InternalLinkTypeGameTypeID is TL type id of InternalLinkTypeGame.
const InternalLinkTypeGameTypeID = 0xf074adcd

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeGame) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeGame{}
)

func (i *InternalLinkTypeGame) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.BotUsername == "") {
		return false
	}
	if !(i.GameShortName == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeGame) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeGame",
		ID:   InternalLinkTypeGameTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "BotUsername",
			SchemaName: "bot_username",
		},
		{
			Name:       "GameShortName",
			SchemaName: "game_short_name",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeGame) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeGame#f074adcd as nil")
	}
	b.PutID(InternalLinkTypeGameTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeGame) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeGame#f074adcd as nil")
	}
	b.PutString(i.BotUsername)
	b.PutString(i.GameShortName)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeGame) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeGame#f074adcd to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: field bot_username: %w", err)
		}
		i.BotUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: field game_short_name: %w", err)
		}
		i.GameShortName = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeGame) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeGame#f074adcd as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeGame")
	b.Comma()
	b.FieldStart("bot_username")
	b.PutString(i.BotUsername)
	b.Comma()
	b.FieldStart("game_short_name")
	b.PutString(i.GameShortName)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeGame) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeGame#f074adcd to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeGame"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: %w", err)
			}
		case "bot_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: field bot_username: %w", err)
			}
			i.BotUsername = value
		case "game_short_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: field game_short_name: %w", err)
			}
			i.GameShortName = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetBotUsername returns value of BotUsername field.
func (i *InternalLinkTypeGame) GetBotUsername() (value string) {
	if i == nil {
		return
	}
	return i.BotUsername
}

// GetGameShortName returns value of GameShortName field.
func (i *InternalLinkTypeGame) GetGameShortName() (value string) {
	if i == nil {
		return
	}
	return i.GameShortName
}

// InternalLinkTypeGroupCall represents TL type `internalLinkTypeGroupCall#7469b416`.
type InternalLinkTypeGroupCall struct {
	// Internal representation of the invite link
	InviteLink string
}

// InternalLinkTypeGroupCallTypeID is TL type id of InternalLinkTypeGroupCall.
const InternalLinkTypeGroupCallTypeID = 0x7469b416

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeGroupCall) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeGroupCall{}
)

func (i *InternalLinkTypeGroupCall) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.InviteLink == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeGroupCall) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeGroupCall",
		ID:   InternalLinkTypeGroupCallTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "InviteLink",
			SchemaName: "invite_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeGroupCall) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeGroupCall#7469b416 as nil")
	}
	b.PutID(InternalLinkTypeGroupCallTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeGroupCall) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeGroupCall#7469b416 as nil")
	}
	b.PutString(i.InviteLink)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeGroupCall) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeGroupCall#7469b416 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeGroupCallTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeGroupCall#7469b416: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeGroupCall) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeGroupCall#7469b416 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeGroupCall#7469b416: field invite_link: %w", err)
		}
		i.InviteLink = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeGroupCall) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeGroupCall#7469b416 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeGroupCall")
	b.Comma()
	b.FieldStart("invite_link")
	b.PutString(i.InviteLink)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeGroupCall) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeGroupCall#7469b416 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeGroupCall"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeGroupCall#7469b416: %w", err)
			}
		case "invite_link":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeGroupCall#7469b416: field invite_link: %w", err)
			}
			i.InviteLink = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetInviteLink returns value of InviteLink field.
func (i *InternalLinkTypeGroupCall) GetInviteLink() (value string) {
	if i == nil {
		return
	}
	return i.InviteLink
}

// InternalLinkTypeInstantView represents TL type `internalLinkTypeInstantView#69e4df3f`.
type InternalLinkTypeInstantView struct {
	// URL to be passed to getWebPageInstantView
	URL string
	// An URL to open if getWebPageInstantView fails
	FallbackURL string
}

// InternalLinkTypeInstantViewTypeID is TL type id of InternalLinkTypeInstantView.
const InternalLinkTypeInstantViewTypeID = 0x69e4df3f

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeInstantView) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeInstantView{}
)

func (i *InternalLinkTypeInstantView) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.URL == "") {
		return false
	}
	if !(i.FallbackURL == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeInstantView) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeInstantView",
		ID:   InternalLinkTypeInstantViewTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "FallbackURL",
			SchemaName: "fallback_url",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeInstantView) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeInstantView#69e4df3f as nil")
	}
	b.PutID(InternalLinkTypeInstantViewTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeInstantView) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeInstantView#69e4df3f as nil")
	}
	b.PutString(i.URL)
	b.PutString(i.FallbackURL)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeInstantView) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeInstantView#69e4df3f to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeInstantViewTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeInstantView) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeInstantView#69e4df3f to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: field url: %w", err)
		}
		i.URL = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: field fallback_url: %w", err)
		}
		i.FallbackURL = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeInstantView) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeInstantView#69e4df3f as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeInstantView")
	b.Comma()
	b.FieldStart("url")
	b.PutString(i.URL)
	b.Comma()
	b.FieldStart("fallback_url")
	b.PutString(i.FallbackURL)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeInstantView) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeInstantView#69e4df3f to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeInstantView"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: %w", err)
			}
		case "url":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: field url: %w", err)
			}
			i.URL = value
		case "fallback_url":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: field fallback_url: %w", err)
			}
			i.FallbackURL = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetURL returns value of URL field.
func (i *InternalLinkTypeInstantView) GetURL() (value string) {
	if i == nil {
		return
	}
	return i.URL
}

// GetFallbackURL returns value of FallbackURL field.
func (i *InternalLinkTypeInstantView) GetFallbackURL() (value string) {
	if i == nil {
		return
	}
	return i.FallbackURL
}

// InternalLinkTypeInvoice represents TL type `internalLinkTypeInvoice#f34c6dac`.
type InternalLinkTypeInvoice struct {
	// Name of the invoice
	InvoiceName string
}

// InternalLinkTypeInvoiceTypeID is TL type id of InternalLinkTypeInvoice.
const InternalLinkTypeInvoiceTypeID = 0xf34c6dac

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeInvoice) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeInvoice{}
)

func (i *InternalLinkTypeInvoice) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.InvoiceName == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeInvoice) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeInvoice",
		ID:   InternalLinkTypeInvoiceTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "InvoiceName",
			SchemaName: "invoice_name",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeInvoice) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeInvoice#f34c6dac as nil")
	}
	b.PutID(InternalLinkTypeInvoiceTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeInvoice) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeInvoice#f34c6dac as nil")
	}
	b.PutString(i.InvoiceName)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeInvoice) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeInvoice#f34c6dac to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeInvoice#f34c6dac: field invoice_name: %w", err)
		}
		i.InvoiceName = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeInvoice) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeInvoice#f34c6dac as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeInvoice")
	b.Comma()
	b.FieldStart("invoice_name")
	b.PutString(i.InvoiceName)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeInvoice) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeInvoice#f34c6dac to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeInvoice"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeInvoice#f34c6dac: %w", err)
			}
		case "invoice_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeInvoice#f34c6dac: field invoice_name: %w", err)
			}
			i.InvoiceName = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetInvoiceName returns value of InvoiceName field.
func (i *InternalLinkTypeInvoice) GetInvoiceName() (value string) {
	if i == nil {
		return
	}
	return i.InvoiceName
}

// InternalLinkTypeLanguagePack represents TL type `internalLinkTypeLanguagePack#a9870d6c`.
type InternalLinkTypeLanguagePack struct {
	// Language pack identifier
	LanguagePackID string
}

// InternalLinkTypeLanguagePackTypeID is TL type id of InternalLinkTypeLanguagePack.
const InternalLinkTypeLanguagePackTypeID = 0xa9870d6c

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeLanguagePack) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeLanguagePack{}
)

func (i *InternalLinkTypeLanguagePack) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.LanguagePackID == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeLanguagePack) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeLanguagePack",
		ID:   InternalLinkTypeLanguagePackTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "LanguagePackID",
			SchemaName: "language_pack_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeLanguagePack) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeLanguagePack#a9870d6c as nil")
	}
	b.PutID(InternalLinkTypeLanguagePackTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeLanguagePack) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeLanguagePack#a9870d6c as nil")
	}
	b.PutString(i.LanguagePackID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeLanguagePack) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeLanguagePack#a9870d6c to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeLanguagePack#a9870d6c: field language_pack_id: %w", err)
		}
		i.LanguagePackID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeLanguagePack) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeLanguagePack#a9870d6c as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeLanguagePack")
	b.Comma()
	b.FieldStart("language_pack_id")
	b.PutString(i.LanguagePackID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeLanguagePack) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeLanguagePack#a9870d6c to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeLanguagePack"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeLanguagePack#a9870d6c: %w", err)
			}
		case "language_pack_id":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeLanguagePack#a9870d6c: field language_pack_id: %w", err)
			}
			i.LanguagePackID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetLanguagePackID returns value of LanguagePackID field.
func (i *InternalLinkTypeLanguagePack) GetLanguagePackID() (value string) {
	if i == nil {
		return
	}
	return i.LanguagePackID
}

// InternalLinkTypeLanguageSettings represents TL type `internalLinkTypeLanguageSettings#b019e6e6`.
type InternalLinkTypeLanguageSettings struct {
}

// InternalLinkTypeLanguageSettingsTypeID is TL type id of InternalLinkTypeLanguageSettings.
const InternalLinkTypeLanguageSettingsTypeID = 0xb019e6e6

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeLanguageSettings) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeLanguageSettings{}
)

func (i *InternalLinkTypeLanguageSettings) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeLanguageSettings) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeLanguageSettings#b019e6e6 as nil")
	}
	b.PutID(InternalLinkTypeLanguageSettingsTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeLanguageSettings) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeLanguageSettings#b019e6e6 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeLanguageSettings")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeLanguageSettings) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeLanguageSettings#b019e6e6 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeLanguageSettings"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeLanguageSettings#b019e6e6: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeMainWebApp represents TL type `internalLinkTypeMainWebApp#5ddf72e9`.
type InternalLinkTypeMainWebApp struct {
	// Username of the bot
	BotUsername string
	// Start parameter to be passed to getMainWebApp
	StartParameter string
	// The mode to be passed to getMainWebApp
	Mode WebAppOpenModeClass
}

// InternalLinkTypeMainWebAppTypeID is TL type id of InternalLinkTypeMainWebApp.
const InternalLinkTypeMainWebAppTypeID = 0x5ddf72e9

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeMainWebApp) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeMainWebApp{}
)

func (i *InternalLinkTypeMainWebApp) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.BotUsername == "") {
		return false
	}
	if !(i.StartParameter == "") {
		return false
	}
	if !(i.Mode == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeMainWebApp) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeMainWebApp",
		ID:   InternalLinkTypeMainWebAppTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "BotUsername",
			SchemaName: "bot_username",
		},
		{
			Name:       "StartParameter",
			SchemaName: "start_parameter",
		},
		{
			Name:       "Mode",
			SchemaName: "mode",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeMainWebApp) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMainWebApp#5ddf72e9 as nil")
	}
	b.PutID(InternalLinkTypeMainWebAppTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeMainWebApp) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMainWebApp#5ddf72e9 as nil")
	}
	b.PutString(i.BotUsername)
	b.PutString(i.StartParameter)
	if i.Mode == nil {
		return fmt.Errorf("unable to encode internalLinkTypeMainWebApp#5ddf72e9: field mode is nil")
	}
	if err := i.Mode.Encode(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeMainWebApp#5ddf72e9: field mode: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeMainWebApp) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMainWebApp#5ddf72e9 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeMainWebAppTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeMainWebApp) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMainWebApp#5ddf72e9 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field bot_username: %w", err)
		}
		i.BotUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field start_parameter: %w", err)
		}
		i.StartParameter = value
	}
	{
		value, err := DecodeWebAppOpenMode(b)
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field mode: %w", err)
		}
		i.Mode = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeMainWebApp) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMainWebApp#5ddf72e9 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeMainWebApp")
	b.Comma()
	b.FieldStart("bot_username")
	b.PutString(i.BotUsername)
	b.Comma()
	b.FieldStart("start_parameter")
	b.PutString(i.StartParameter)
	b.Comma()
	b.FieldStart("mode")
	if i.Mode == nil {
		return fmt.Errorf("unable to encode internalLinkTypeMainWebApp#5ddf72e9: field mode is nil")
	}
	if err := i.Mode.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeMainWebApp#5ddf72e9: field mode: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeMainWebApp) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMainWebApp#5ddf72e9 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeMainWebApp"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: %w", err)
			}
		case "bot_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field bot_username: %w", err)
			}
			i.BotUsername = value
		case "start_parameter":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field start_parameter: %w", err)
			}
			i.StartParameter = value
		case "mode":
			value, err := DecodeTDLibJSONWebAppOpenMode(b)
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field mode: %w", err)
			}
			i.Mode = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetBotUsername returns value of BotUsername field.
func (i *InternalLinkTypeMainWebApp) GetBotUsername() (value string) {
	if i == nil {
		return
	}
	return i.BotUsername
}

// GetStartParameter returns value of StartParameter field.
func (i *InternalLinkTypeMainWebApp) GetStartParameter() (value string) {
	if i == nil {
		return
	}
	return i.StartParameter
}

// GetMode returns value of Mode field.
func (i *InternalLinkTypeMainWebApp) GetMode() (value WebAppOpenModeClass) {
	if i == nil {
		return
	}
	return i.Mode
}

// InternalLinkTypeMessage represents TL type `internalLinkTypeMessage#3a535c52`.
type InternalLinkTypeMessage struct {
	// URL to be passed to getMessageLinkInfo
	URL string
}

// InternalLinkTypeMessageTypeID is TL type id of InternalLinkTypeMessage.
const InternalLinkTypeMessageTypeID = 0x3a535c52

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeMessage) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeMessage{}
)

func (i *InternalLinkTypeMessage) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.URL == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeMessage) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeMessage",
		ID:   InternalLinkTypeMessageTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeMessage) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMessage#3a535c52 as nil")
	}
	b.PutID(InternalLinkTypeMessageTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeMessage) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMessage#3a535c52 as nil")
	}
	b.PutString(i.URL)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeMessage) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMessage#3a535c52 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeMessageTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeMessage#3a535c52: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeMessage) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMessage#3a535c52 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeMessage#3a535c52: field url: %w", err)
		}
		i.URL = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeMessage) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMessage#3a535c52 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeMessage")
	b.Comma()
	b.FieldStart("url")
	b.PutString(i.URL)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeMessage) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMessage#3a535c52 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeMessage"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMessage#3a535c52: %w", err)
			}
		case "url":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMessage#3a535c52: field url: %w", err)
			}
			i.URL = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetURL returns value of URL field.
func (i *InternalLinkTypeMessage) GetURL() (value string) {
	if i == nil {
		return
	}
	return i.URL
}

// InternalLinkTypeMessageDraft represents TL type `internalLinkTypeMessageDraft#276fbad5`.
type InternalLinkTypeMessageDraft struct {
	// Message draft text
	Text FormattedText
	// True, if the first line of the text contains a link. If true, the input field needs to
	// be focused and the text after the link must be selected
	ContainsLink bool
}

// InternalLinkTypeMessageDraftTypeID is TL type id of InternalLinkTypeMessageDraft.
const InternalLinkTypeMessageDraftTypeID = 0x276fbad5

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeMessageDraft) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeMessageDraft{}
)

func (i *InternalLinkTypeMessageDraft) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Text.Zero()) {
		return false
	}
	if !(i.ContainsLink == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeMessageDraft) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeMessageDraft",
		ID:   InternalLinkTypeMessageDraftTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "ContainsLink",
			SchemaName: "contains_link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeMessageDraft) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMessageDraft#276fbad5 as nil")
	}
	b.PutID(InternalLinkTypeMessageDraftTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeMessageDraft) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMessageDraft#276fbad5 as nil")
	}
	if err := i.Text.Encode(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeMessageDraft#276fbad5: field text: %w", err)
	}
	b.PutBool(i.ContainsLink)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeMessageDraft) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMessageDraft#276fbad5 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeMessageDraftTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeMessageDraft) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMessageDraft#276fbad5 to nil")
	}
	{
		if err := i.Text.Decode(b); err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: field text: %w", err)
		}
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: field contains_link: %w", err)
		}
		i.ContainsLink = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeMessageDraft) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMessageDraft#276fbad5 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeMessageDraft")
	b.Comma()
	b.FieldStart("text")
	if err := i.Text.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeMessageDraft#276fbad5: field text: %w", err)
	}
	b.Comma()
	b.FieldStart("contains_link")
	b.PutBool(i.ContainsLink)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeMessageDraft) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMessageDraft#276fbad5 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeMessageDraft"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: %w", err)
			}
		case "text":
			if err := i.Text.DecodeTDLibJSON(b); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: field text: %w", err)
			}
		case "contains_link":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: field contains_link: %w", err)
			}
			i.ContainsLink = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetText returns value of Text field.
func (i *InternalLinkTypeMessageDraft) GetText() (value FormattedText) {
	if i == nil {
		return
	}
	return i.Text
}

// GetContainsLink returns value of ContainsLink field.
func (i *InternalLinkTypeMessageDraft) GetContainsLink() (value bool) {
	if i == nil {
		return
	}
	return i.ContainsLink
}

// InternalLinkTypeMyStars represents TL type `internalLinkTypeMyStars#6031f65e`.
type InternalLinkTypeMyStars struct {
}

// InternalLinkTypeMyStarsTypeID is TL type id of InternalLinkTypeMyStars.
const InternalLinkTypeMyStarsTypeID = 0x6031f65e

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeMyStars) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeMyStars{}
)

func (i *InternalLinkTypeMyStars) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeMyStars) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMyStars#6031f65e as nil")
	}
	b.PutID(InternalLinkTypeMyStarsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeMyStars) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMyStars#6031f65e as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeMyStars) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMyStars#6031f65e to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeMyStarsTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeMyStars#6031f65e: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeMyStars) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMyStars#6031f65e to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeMyStars) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeMyStars#6031f65e as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeMyStars")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeMyStars) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeMyStars#6031f65e to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeMyStars"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeMyStars#6031f65e: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypePassportDataRequest represents TL type `internalLinkTypePassportDataRequest#c50fce81`.
type InternalLinkTypePassportDataRequest struct {
	// User identifier of the service's bot; the corresponding user may be unknown yet
	BotUserID int64
	// Telegram Passport element types requested by the service
	Scope string
	// Service's public key
	PublicKey string
	// Unique request identifier provided by the service
	Nonce string
	// An HTTP URL to open once the request is finished, canceled, or failed with the
	// parameters tg_passport=success, tg_passport=cancel, or tg_passport=error&error=...
	// respectively.
	CallbackURL string
}

// InternalLinkTypePassportDataRequestTypeID is TL type id of InternalLinkTypePassportDataRequest.
const InternalLinkTypePassportDataRequestTypeID = 0xc50fce81

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypePassportDataRequest) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypePassportDataRequest{}
)

func (i *InternalLinkTypePassportDataRequest) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.BotUserID == 0) {
		return false
	}
	if !(i.Scope == "") {
		return false
	}
	if !(i.PublicKey == "") {
		return false
	}
	if !(i.Nonce == "") {
		return false
	}
	if !(i.CallbackURL == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypePassportDataRequest) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypePassportDataRequest",
		ID:   InternalLinkTypePassportDataRequestTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "BotUserID",
			SchemaName: "bot_user_id",
		},
		{
			Name:       "Scope",
			SchemaName: "scope",
		},
		{
			Name:       "PublicKey",
			SchemaName: "public_key",
		},
		{
			Name:       "Nonce",
			SchemaName: "nonce",
		},
		{
			Name:       "CallbackURL",
			SchemaName: "callback_url",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypePassportDataRequest) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePassportDataRequest#c50fce81 as nil")
	}
	b.PutID(InternalLinkTypePassportDataRequestTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypePassportDataRequest) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePassportDataRequest#c50fce81 as nil")
	}
	b.PutInt53(i.BotUserID)
	b.PutString(i.Scope)
	b.PutString(i.PublicKey)
	b.PutString(i.Nonce)
	b.PutString(i.CallbackURL)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypePassportDataRequest) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePassportDataRequest#c50fce81 to nil")
	}
	{
		value, err := b.Int53()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field bot_user_id: %w", err)
		}
		i.BotUserID = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field scope: %w", err)
		}
		i.Scope = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field public_key: %w", err)
		}
		i.PublicKey = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field nonce: %w", err)
		}
		i.Nonce = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field callback_url: %w", err)
		}
		i.CallbackURL = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypePassportDataRequest) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePassportDataRequest#c50fce81 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypePassportDataRequest")
	b.Comma()
	b.FieldStart("bot_user_id")
	b.PutInt53(i.BotUserID)
	b.Comma()
	b.FieldStart("scope")
	b.PutString(i.Scope)
	b.Comma()
	b.FieldStart("public_key")
	b.PutString(i.PublicKey)
	b.Comma()
	b.FieldStart("nonce")
	b.PutString(i.Nonce)
	b.Comma()
	b.FieldStart("callback_url")
	b.PutString(i.CallbackURL)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypePassportDataRequest) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePassportDataRequest#c50fce81 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypePassportDataRequest"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: %w", err)
			}
		case "bot_user_id":
			value, err := b.Int53()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field bot_user_id: %w", err)
			}
			i.BotUserID = value
		case "scope":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field scope: %w", err)
			}
			i.Scope = value
		case "public_key":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field public_key: %w", err)
			}
			i.PublicKey = value
		case "nonce":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field nonce: %w", err)
			}
			i.Nonce = value
		case "callback_url":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field callback_url: %w", err)
			}
			i.CallbackURL = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetBotUserID returns value of BotUserID field.
func (i *InternalLinkTypePassportDataRequest) GetBotUserID() (value int64) {
	if i == nil {
		return
	}
	return i.BotUserID
}

// GetScope returns value of Scope field.
func (i *InternalLinkTypePassportDataRequest) GetScope() (value string) {
	if i == nil {
		return
	}
	return i.Scope
}

// GetPublicKey returns value of PublicKey field.
func (i *InternalLinkTypePassportDataRequest) GetPublicKey() (value string) {
	if i == nil {
		return
	}
	return i.PublicKey
}

// GetNonce returns value of Nonce field.
func (i *InternalLinkTypePassportDataRequest) GetNonce() (value string) {
	if i == nil {
		return
	}
	return i.Nonce
}

// GetCallbackURL returns value of CallbackURL field.
func (i *InternalLinkTypePassportDataRequest) GetCallbackURL() (value string) {
	if i == nil {
		return
	}
	return i.CallbackURL
}

// InternalLinkTypePhoneNumberConfirmation represents TL type `internalLinkTypePhoneNumberConfirmation#68bf6b16`.
type InternalLinkTypePhoneNumberConfirmation struct {
	// Hash value from the link
	Hash string
	// Phone number value from the link
	PhoneNumber string
}

// InternalLinkTypePhoneNumberConfirmationTypeID is TL type id of InternalLinkTypePhoneNumberConfirmation.
const InternalLinkTypePhoneNumberConfirmationTypeID = 0x68bf6b16

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypePhoneNumberConfirmation) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypePhoneNumberConfirmation{}
)

func (i *InternalLinkTypePhoneNumberConfirmation) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Hash == "") {
		return false
	}
	if !(i.PhoneNumber == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypePhoneNumberConfirmation) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypePhoneNumberConfirmation",
		ID:   InternalLinkTypePhoneNumberConfirmationTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypePhoneNumberConfirmation) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePhoneNumberConfirmation#68bf6b16 as nil")
	}
	b.PutID(InternalLinkTypePhoneNumberConfirmationTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypePhoneNumberConfirmation) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePhoneNumberConfirmation#68bf6b16 as nil")
	}
	b.PutString(i.Hash)
	b.PutString(i.PhoneNumber)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypePhoneNumberConfirmation) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePhoneNumberConfirmation#68bf6b16 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypePhoneNumberConfirmationTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypePhoneNumberConfirmation) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePhoneNumberConfirmation#68bf6b16 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: field hash: %w", err)
		}
		i.Hash = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: field phone_number: %w", err)
		}
		i.PhoneNumber = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypePhoneNumberConfirmation) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePhoneNumberConfirmation#68bf6b16 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypePhoneNumberConfirmation")
	b.Comma()
	b.FieldStart("hash")
	b.PutString(i.Hash)
	b.Comma()
	b.FieldStart("phone_number")
	b.PutString(i.PhoneNumber)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypePhoneNumberConfirmation) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePhoneNumberConfirmation#68bf6b16 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypePhoneNumberConfirmation"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: %w", err)
			}
		case "hash":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: field hash: %w", err)
			}
			i.Hash = value
		case "phone_number":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: field phone_number: %w", err)
			}
			i.PhoneNumber = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetHash returns value of Hash field.
func (i *InternalLinkTypePhoneNumberConfirmation) GetHash() (value string) {
	if i == nil {
		return
	}
	return i.Hash
}

// GetPhoneNumber returns value of PhoneNumber field.
func (i *InternalLinkTypePhoneNumberConfirmation) GetPhoneNumber() (value string) {
	if i == nil {
		return
	}
	return i.PhoneNumber
}

// InternalLinkTypePremiumFeatures represents TL type `internalLinkTypePremiumFeatures#48884f49`.
type InternalLinkTypePremiumFeatures struct {
	// Referrer specified in the link
	Referrer string
}

// InternalLinkTypePremiumFeaturesTypeID is TL type id of InternalLinkTypePremiumFeatures.
const InternalLinkTypePremiumFeaturesTypeID = 0x48884f49

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypePremiumFeatures) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypePremiumFeatures{}
)

func (i *InternalLinkTypePremiumFeatures) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Referrer == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypePremiumFeatures) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypePremiumFeatures",
		ID:   InternalLinkTypePremiumFeaturesTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Referrer",
			SchemaName: "referrer",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypePremiumFeatures) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumFeatures#48884f49 as nil")
	}
	b.PutID(InternalLinkTypePremiumFeaturesTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypePremiumFeatures) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumFeatures#48884f49 as nil")
	}
	b.PutString(i.Referrer)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypePremiumFeatures) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePremiumFeatures#48884f49 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypePremiumFeaturesTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypePremiumFeatures#48884f49: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypePremiumFeatures) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePremiumFeatures#48884f49 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePremiumFeatures#48884f49: field referrer: %w", err)
		}
		i.Referrer = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypePremiumFeatures) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumFeatures#48884f49 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypePremiumFeatures")
	b.Comma()
	b.FieldStart("referrer")
	b.PutString(i.Referrer)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypePremiumFeatures) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePremiumFeatures#48884f49 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypePremiumFeatures"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePremiumFeatures#48884f49: %w", err)
			}
		case "referrer":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePremiumFeatures#48884f49: field referrer: %w", err)
			}
			i.Referrer = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetReferrer returns value of Referrer field.
func (i *InternalLinkTypePremiumFeatures) GetReferrer() (value string) {
	if i == nil {
		return
	}
	return i.Referrer
}

// InternalLinkTypePremiumGift represents TL type `internalLinkTypePremiumGift#5ad56d41`.
type InternalLinkTypePremiumGift struct {
	// Referrer specified in the link
	Referrer string
}

// InternalLinkTypePremiumGiftTypeID is TL type id of InternalLinkTypePremiumGift.
const InternalLinkTypePremiumGiftTypeID = 0x5ad56d41

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypePremiumGift) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypePremiumGift{}
)

func (i *InternalLinkTypePremiumGift) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Referrer == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypePremiumGift) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypePremiumGift",
		ID:   InternalLinkTypePremiumGiftTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Referrer",
			SchemaName: "referrer",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypePremiumGift) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumGift#5ad56d41 as nil")
	}
	b.PutID(InternalLinkTypePremiumGiftTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypePremiumGift) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumGift#5ad56d41 as nil")
	}
	b.PutString(i.Referrer)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypePremiumGift) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePremiumGift#5ad56d41 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypePremiumGiftTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypePremiumGift#5ad56d41: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypePremiumGift) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePremiumGift#5ad56d41 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePremiumGift#5ad56d41: field referrer: %w", err)
		}
		i.Referrer = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypePremiumGift) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumGift#5ad56d41 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypePremiumGift")
	b.Comma()
	b.FieldStart("referrer")
	b.PutString(i.Referrer)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypePremiumGift) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePremiumGift#5ad56d41 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypePremiumGift"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePremiumGift#5ad56d41: %w", err)
			}
		case "referrer":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePremiumGift#5ad56d41: field referrer: %w", err)
			}
			i.Referrer = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetReferrer returns value of Referrer field.
func (i *InternalLinkTypePremiumGift) GetReferrer() (value string) {
	if i == nil {
		return
	}
	return i.Referrer
}

// InternalLinkTypePremiumGiftCode represents TL type `internalLinkTypePremiumGiftCode#de5c9892`.
type InternalLinkTypePremiumGiftCode struct {
	// The Telegram Premium gift code
	Code string
}

// InternalLinkTypePremiumGiftCodeTypeID is TL type id of InternalLinkTypePremiumGiftCode.
const InternalLinkTypePremiumGiftCodeTypeID = 0xde5c9892

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypePremiumGiftCode) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypePremiumGiftCode{}
)

func (i *InternalLinkTypePremiumGiftCode) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Code == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypePremiumGiftCode) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypePremiumGiftCode",
		ID:   InternalLinkTypePremiumGiftCodeTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Code",
			SchemaName: "code",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypePremiumGiftCode) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumGiftCode#de5c9892 as nil")
	}
	b.PutID(InternalLinkTypePremiumGiftCodeTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypePremiumGiftCode) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumGiftCode#de5c9892 as nil")
	}
	b.PutString(i.Code)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypePremiumGiftCode) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePremiumGiftCode#de5c9892 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePremiumGiftCode#de5c9892: field code: %w", err)
		}
		i.Code = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypePremiumGiftCode) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePremiumGiftCode#de5c9892 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypePremiumGiftCode")
	b.Comma()
	b.FieldStart("code")
	b.PutString(i.Code)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypePremiumGiftCode) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePremiumGiftCode#de5c9892 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypePremiumGiftCode"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePremiumGiftCode#de5c9892: %w", err)
			}
		case "code":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePremiumGiftCode#de5c9892: field code: %w", err)
			}
			i.Code = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetCode returns value of Code field.
func (i *InternalLinkTypePremiumGiftCode) GetCode() (value string) {
	if i == nil {
		return
	}
	return i.Code
}

// InternalLinkTypePrivacyAndSecuritySettings represents TL type `internalLinkTypePrivacyAndSecuritySettings#ad5f6acf`.
type InternalLinkTypePrivacyAndSecuritySettings struct {
}

// InternalLinkTypePrivacyAndSecuritySettingsTypeID is TL type id of InternalLinkTypePrivacyAndSecuritySettings.
const InternalLinkTypePrivacyAndSecuritySettingsTypeID = 0xad5f6acf

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypePrivacyAndSecuritySettings) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypePrivacyAndSecuritySettings{}
)

func (i *InternalLinkTypePrivacyAndSecuritySettings) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypePrivacyAndSecuritySettings) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf as nil")
	}
	b.PutID(InternalLinkTypePrivacyAndSecuritySettingsTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypePrivacyAndSecuritySettings) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypePrivacyAndSecuritySettings")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypePrivacyAndSecuritySettings) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypePrivacyAndSecuritySettings"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeProxy represents TL type `internalLinkTypeProxy#b1b12cea`.
type InternalLinkTypeProxy struct {
	// Proxy server domain or IP address
	Server string
	// Proxy server port
	Port int32
	// Type of the proxy
	Type ProxyTypeClass
}

// InternalLinkTypeProxyTypeID is TL type id of InternalLinkTypeProxy.
const InternalLinkTypeProxyTypeID = 0xb1b12cea

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeProxy) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeProxy{}
)

func (i *InternalLinkTypeProxy) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Server == "") {
		return false
	}
	if !(i.Port == 0) {
		return false
	}
	if !(i.Type == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeProxy) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeProxy",
		ID:   InternalLinkTypeProxyTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Server",
			SchemaName: "server",
		},
		{
			Name:       "Port",
			SchemaName: "port",
		},
		{
			Name:       "Type",
			SchemaName: "type",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeProxy) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeProxy#b1b12cea as nil")
	}
	b.PutID(InternalLinkTypeProxyTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeProxy) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeProxy#b1b12cea as nil")
	}
	b.PutString(i.Server)
	b.PutInt32(i.Port)
	if i.Type == nil {
		return fmt.Errorf("unable to encode internalLinkTypeProxy#b1b12cea: field type is nil")
	}
	if err := i.Type.Encode(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeProxy#b1b12cea: field type: %w", err)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeProxy) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeProxy#b1b12cea to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field server: %w", err)
		}
		i.Server = value
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field port: %w", err)
		}
		i.Port = value
	}
	{
		value, err := DecodeProxyType(b)
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field type: %w", err)
		}
		i.Type = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeProxy) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeProxy#b1b12cea as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeProxy")
	b.Comma()
	b.FieldStart("server")
	b.PutString(i.Server)
	b.Comma()
	b.FieldStart("port")
	b.PutInt32(i.Port)
	b.Comma()
	b.FieldStart("type")
	if i.Type == nil {
		return fmt.Errorf("unable to encode internalLinkTypeProxy#b1b12cea: field type is nil")
	}
	if err := i.Type.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeProxy#b1b12cea: field type: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeProxy) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeProxy#b1b12cea to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeProxy"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: %w", err)
			}
		case "server":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field server: %w", err)
			}
			i.Server = value
		case "port":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field port: %w", err)
			}
			i.Port = value
		case "type":
			value, err := DecodeTDLibJSONProxyType(b)
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field type: %w", err)
			}
			i.Type = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetServer returns value of Server field.
func (i *InternalLinkTypeProxy) GetServer() (value string) {
	if i == nil {
		return
	}
	return i.Server
}

// GetPort returns value of Port field.
func (i *InternalLinkTypeProxy) GetPort() (value int32) {
	if i == nil {
		return
	}
	return i.Port
}

// GetType returns value of Type field.
func (i *InternalLinkTypeProxy) GetType() (value ProxyTypeClass) {
	if i == nil {
		return
	}
	return i.Type
}

// InternalLinkTypePublicChat represents TL type `internalLinkTypePublicChat#697a2d00`.
type InternalLinkTypePublicChat struct {
	// Username of the chat
	ChatUsername string
	// Draft text for message to send in the chat
	DraftText string
	// True, if chat profile information screen must be opened; otherwise, the chat itself
	// must be opened
	OpenProfile bool
}

// InternalLinkTypePublicChatTypeID is TL type id of InternalLinkTypePublicChat.
const InternalLinkTypePublicChatTypeID = 0x697a2d00

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypePublicChat) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypePublicChat{}
)

func (i *InternalLinkTypePublicChat) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.ChatUsername == "") {
		return false
	}
	if !(i.DraftText == "") {
		return false
	}
	if !(i.OpenProfile == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypePublicChat) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypePublicChat",
		ID:   InternalLinkTypePublicChatTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ChatUsername",
			SchemaName: "chat_username",
		},
		{
			Name:       "DraftText",
			SchemaName: "draft_text",
		},
		{
			Name:       "OpenProfile",
			SchemaName: "open_profile",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypePublicChat) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil")
	}
	b.PutID(InternalLinkTypePublicChatTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypePublicChat) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil")
	}
	b.PutString(i.ChatUsername)
	b.PutString(i.DraftText)
	b.PutBool(i.OpenProfile)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypePublicChat) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypePublicChatTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypePublicChat) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field chat_username: %w", err)
		}
		i.ChatUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field draft_text: %w", err)
		}
		i.DraftText = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field open_profile: %w", err)
		}
		i.OpenProfile = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypePublicChat) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypePublicChat")
	b.Comma()
	b.FieldStart("chat_username")
	b.PutString(i.ChatUsername)
	b.Comma()
	b.FieldStart("draft_text")
	b.PutString(i.DraftText)
	b.Comma()
	b.FieldStart("open_profile")
	b.PutBool(i.OpenProfile)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypePublicChat) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypePublicChat"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: %w", err)
			}
		case "chat_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field chat_username: %w", err)
			}
			i.ChatUsername = value
		case "draft_text":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field draft_text: %w", err)
			}
			i.DraftText = value
		case "open_profile":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field open_profile: %w", err)
			}
			i.OpenProfile = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetChatUsername returns value of ChatUsername field.
func (i *InternalLinkTypePublicChat) GetChatUsername() (value string) {
	if i == nil {
		return
	}
	return i.ChatUsername
}

// GetDraftText returns value of DraftText field.
func (i *InternalLinkTypePublicChat) GetDraftText() (value string) {
	if i == nil {
		return
	}
	return i.DraftText
}

// GetOpenProfile returns value of OpenProfile field.
func (i *InternalLinkTypePublicChat) GetOpenProfile() (value bool) {
	if i == nil {
		return
	}
	return i.OpenProfile
}

// InternalLinkTypeQrCodeAuthentication represents TL type `internalLinkTypeQrCodeAuthentication#bf121924`.
type InternalLinkTypeQrCodeAuthentication struct {
}

// InternalLinkTypeQrCodeAuthenticationTypeID is TL type id of InternalLinkTypeQrCodeAuthentication.
const InternalLinkTypeQrCodeAuthenticationTypeID = 0xbf121924

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeQrCodeAuthentication) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeQrCodeAuthentication{}
)

func (i *InternalLinkTypeQrCodeAuthentication) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeQrCodeAuthentication) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeQrCodeAuthentication#bf121924 as nil")
	}
	b.PutID(InternalLinkTypeQrCodeAuthenticationTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeQrCodeAuthentication) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeQrCodeAuthentication#bf121924 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeQrCodeAuthentication")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeQrCodeAuthentication) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeQrCodeAuthentication#bf121924 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeQrCodeAuthentication"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeQrCodeAuthentication#bf121924: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeRestorePurchases represents TL type `internalLinkTypeRestorePurchases#24203483`.
type InternalLinkTypeRestorePurchases struct {
}

// InternalLinkTypeRestorePurchasesTypeID is TL type id of InternalLinkTypeRestorePurchases.
const InternalLinkTypeRestorePurchasesTypeID = 0x24203483

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeRestorePurchases) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeRestorePurchases{}
)

func (i *InternalLinkTypeRestorePurchases) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeRestorePurchases) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeRestorePurchases#24203483 as nil")
	}
	b.PutID(InternalLinkTypeRestorePurchasesTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeRestorePurchases) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeRestorePurchases#24203483 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeRestorePurchases")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeRestorePurchases) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeRestorePurchases#24203483 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeRestorePurchases"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeRestorePurchases#24203483: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeSettings represents TL type `internalLinkTypeSettings#177545b4`.
type InternalLinkTypeSettings struct {
}

// InternalLinkTypeSettingsTypeID is TL type id of InternalLinkTypeSettings.
const InternalLinkTypeSettingsTypeID = 0x177545b4

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeSettings) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeSettings{}
)

func (i *InternalLinkTypeSettings) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeSettings) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeSettings#177545b4 as nil")
	}
	b.PutID(InternalLinkTypeSettingsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeSettings) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeSettings#177545b4 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeSettings) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeSettings#177545b4 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeSettingsTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeSettings#177545b4: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeSettings) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeSettings#177545b4 to nil")
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeSettings) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeSettings#177545b4 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeSettings")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeSettings) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeSettings#177545b4 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeSettings"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeSettings#177545b4: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeStickerSet represents TL type `internalLinkTypeStickerSet#a1464fa2`.
type InternalLinkTypeStickerSet struct {
	// Name of the sticker set
	StickerSetName string
	// True, if the sticker set is expected to contain custom emoji
	ExpectCustomEmoji bool
}

// InternalLinkTypeStickerSetTypeID is TL type id of InternalLinkTypeStickerSet.
const InternalLinkTypeStickerSetTypeID = 0xa1464fa2

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeStickerSet) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeStickerSet{}
)

func (i *InternalLinkTypeStickerSet) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.StickerSetName == "") {
		return false
	}
	if !(i.ExpectCustomEmoji == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeStickerSet) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeStickerSet",
		ID:   InternalLinkTypeStickerSetTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "StickerSetName",
			SchemaName: "sticker_set_name",
		},
		{
			Name:       "ExpectCustomEmoji",
			SchemaName: "expect_custom_emoji",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeStickerSet) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeStickerSet#a1464fa2 as nil")
	}
	b.PutID(InternalLinkTypeStickerSetTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeStickerSet) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeStickerSet#a1464fa2 as nil")
	}
	b.PutString(i.StickerSetName)
	b.PutBool(i.ExpectCustomEmoji)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeStickerSet) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeStickerSet#a1464fa2 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: field sticker_set_name: %w", err)
		}
		i.StickerSetName = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: field expect_custom_emoji: %w", err)
		}
		i.ExpectCustomEmoji = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeStickerSet) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeStickerSet#a1464fa2 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeStickerSet")
	b.Comma()
	b.FieldStart("sticker_set_name")
	b.PutString(i.StickerSetName)
	b.Comma()
	b.FieldStart("expect_custom_emoji")
	b.PutBool(i.ExpectCustomEmoji)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeStickerSet) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeStickerSet#a1464fa2 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeStickerSet"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: %w", err)
			}
		case "sticker_set_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: field sticker_set_name: %w", err)
			}
			i.StickerSetName = value
		case "expect_custom_emoji":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: field expect_custom_emoji: %w", err)
			}
			i.ExpectCustomEmoji = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetStickerSetName returns value of StickerSetName field.
func (i *InternalLinkTypeStickerSet) GetStickerSetName() (value string) {
	if i == nil {
		return
	}
	return i.StickerSetName
}

// GetExpectCustomEmoji returns value of ExpectCustomEmoji field.
func (i *InternalLinkTypeStickerSet) GetExpectCustomEmoji() (value bool) {
	if i == nil {
		return
	}
	return i.ExpectCustomEmoji
}

// InternalLinkTypeStory represents TL type `internalLinkTypeStory#6e63ee75`.
type InternalLinkTypeStory struct {
	// Username of the poster of the story
	StoryPosterUsername string
	// Story identifier
	StoryID int32
}

// InternalLinkTypeStoryTypeID is TL type id of InternalLinkTypeStory.
const InternalLinkTypeStoryTypeID = 0x6e63ee75

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeStory) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeStory{}
)

func (i *InternalLinkTypeStory) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.StoryPosterUsername == "") {
		return false
	}
	if !(i.StoryID == 0) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeStory) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeStory",
		ID:   InternalLinkTypeStoryTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "StoryPosterUsername",
			SchemaName: "story_poster_username",
		},
		{
			Name:       "StoryID",
			SchemaName: "story_id",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeStory) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeStory#6e63ee75 as nil")
	}
	b.PutID(InternalLinkTypeStoryTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeStory) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeStory#6e63ee75 as nil")
	}
	b.PutString(i.StoryPosterUsername)
	b.PutInt32(i.StoryID)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeStory) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeStory#6e63ee75 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeStoryTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeStory#6e63ee75: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeStory) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeStory#6e63ee75 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeStory#6e63ee75: field story_poster_username: %w", err)
		}
		i.StoryPosterUsername = value
	}
	{
		value, err := b.Int32()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeStory#6e63ee75: field story_id: %w", err)
		}
		i.StoryID = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeStory) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeStory#6e63ee75 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeStory")
	b.Comma()
	b.FieldStart("story_poster_username")
	b.PutString(i.StoryPosterUsername)
	b.Comma()
	b.FieldStart("story_id")
	b.PutInt32(i.StoryID)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeStory) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeStory#6e63ee75 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeStory"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeStory#6e63ee75: %w", err)
			}
		case "story_poster_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeStory#6e63ee75: field story_poster_username: %w", err)
			}
			i.StoryPosterUsername = value
		case "story_id":
			value, err := b.Int32()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeStory#6e63ee75: field story_id: %w", err)
			}
			i.StoryID = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetStoryPosterUsername returns value of StoryPosterUsername field.
func (i *InternalLinkTypeStory) GetStoryPosterUsername() (value string) {
	if i == nil {
		return
	}
	return i.StoryPosterUsername
}

// GetStoryID returns value of StoryID field.
func (i *InternalLinkTypeStory) GetStoryID() (value int32) {
	if i == nil {
		return
	}
	return i.StoryID
}

// InternalLinkTypeTheme represents TL type `internalLinkTypeTheme#f405f807`.
type InternalLinkTypeTheme struct {
	// Name of the theme
	ThemeName string
}

// InternalLinkTypeThemeTypeID is TL type id of InternalLinkTypeTheme.
const InternalLinkTypeThemeTypeID = 0xf405f807

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeTheme) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeTheme{}
)

func (i *InternalLinkTypeTheme) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.ThemeName == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeTheme) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeTheme",
		ID:   InternalLinkTypeThemeTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ThemeName",
			SchemaName: "theme_name",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeTheme) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeTheme#f405f807 as nil")
	}
	b.PutID(InternalLinkTypeThemeTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeTheme) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeTheme#f405f807 as nil")
	}
	b.PutString(i.ThemeName)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeTheme) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeTheme#f405f807 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeTheme#f405f807: field theme_name: %w", err)
		}
		i.ThemeName = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeTheme) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeTheme#f405f807 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeTheme")
	b.Comma()
	b.FieldStart("theme_name")
	b.PutString(i.ThemeName)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeTheme) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeTheme#f405f807 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeTheme"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeTheme#f405f807: %w", err)
			}
		case "theme_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeTheme#f405f807: field theme_name: %w", err)
			}
			i.ThemeName = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetThemeName returns value of ThemeName field.
func (i *InternalLinkTypeTheme) GetThemeName() (value string) {
	if i == nil {
		return
	}
	return i.ThemeName
}

// InternalLinkTypeThemeSettings represents TL type `internalLinkTypeThemeSettings#c14d3916`.
type InternalLinkTypeThemeSettings struct {
}

// InternalLinkTypeThemeSettingsTypeID is TL type id of InternalLinkTypeThemeSettings.
const InternalLinkTypeThemeSettingsTypeID = 0xc14d3916

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeThemeSettings) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeThemeSettings{}
)

func (i *InternalLinkTypeThemeSettings) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeThemeSettings) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeThemeSettings#c14d3916 as nil")
	}
	b.PutID(InternalLinkTypeThemeSettingsTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeThemeSettings) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeThemeSettings#c14d3916 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeThemeSettings")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeThemeSettings) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeThemeSettings#c14d3916 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeThemeSettings"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeThemeSettings#c14d3916: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeUnknownDeepLink represents TL type `internalLinkTypeUnknownDeepLink#2549d7db`.
type InternalLinkTypeUnknownDeepLink struct {
	// Link to be passed to getDeepLinkInfo
	Link string
}

// InternalLinkTypeUnknownDeepLinkTypeID is TL type id of InternalLinkTypeUnknownDeepLink.
const InternalLinkTypeUnknownDeepLinkTypeID = 0x2549d7db

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeUnknownDeepLink) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeUnknownDeepLink{}
)

func (i *InternalLinkTypeUnknownDeepLink) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Link == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeUnknownDeepLink) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeUnknownDeepLink",
		ID:   InternalLinkTypeUnknownDeepLinkTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Link",
			SchemaName: "link",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeUnknownDeepLink) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUnknownDeepLink#2549d7db as nil")
	}
	b.PutID(InternalLinkTypeUnknownDeepLinkTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeUnknownDeepLink) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUnknownDeepLink#2549d7db as nil")
	}
	b.PutString(i.Link)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeUnknownDeepLink) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUnknownDeepLink#2549d7db to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeUnknownDeepLinkTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeUnknownDeepLink#2549d7db: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeUnknownDeepLink) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUnknownDeepLink#2549d7db to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeUnknownDeepLink#2549d7db: field link: %w", err)
		}
		i.Link = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeUnknownDeepLink) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUnknownDeepLink#2549d7db as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeUnknownDeepLink")
	b.Comma()
	b.FieldStart("link")
	b.PutString(i.Link)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeUnknownDeepLink) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUnknownDeepLink#2549d7db to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeUnknownDeepLink"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUnknownDeepLink#2549d7db: %w", err)
			}
		case "link":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUnknownDeepLink#2549d7db: field link: %w", err)
			}
			i.Link = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetLink returns value of Link field.
func (i *InternalLinkTypeUnknownDeepLink) GetLink() (value string) {
	if i == nil {
		return
	}
	return i.Link
}

// InternalLinkTypeUnsupportedProxy represents TL type `internalLinkTypeUnsupportedProxy#de399f09`.
type InternalLinkTypeUnsupportedProxy struct {
}

// InternalLinkTypeUnsupportedProxyTypeID is TL type id of InternalLinkTypeUnsupportedProxy.
const InternalLinkTypeUnsupportedProxyTypeID = 0xde399f09

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeUnsupportedProxy) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeUnsupportedProxy{}
)

func (i *InternalLinkTypeUnsupportedProxy) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InternalLinkTypeUnsupportedProxy) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUnsupportedProxy#de399f09 as nil")
	}
	b.PutID(InternalLinkTypeUnsupportedProxyTypeID)
	return i.EncodeBare(b)
}

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

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

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

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeUnsupportedProxy) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUnsupportedProxy#de399f09 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeUnsupportedProxy")
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeUnsupportedProxy) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUnsupportedProxy#de399f09 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeUnsupportedProxy"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUnsupportedProxy#de399f09: %w", err)
			}
		default:
			return b.Skip()
		}
		return nil
	})
}

// InternalLinkTypeUpgradedGift represents TL type `internalLinkTypeUpgradedGift#d5c6969b`.
type InternalLinkTypeUpgradedGift struct {
	// Name of the unique gift
	Name string
}

// InternalLinkTypeUpgradedGiftTypeID is TL type id of InternalLinkTypeUpgradedGift.
const InternalLinkTypeUpgradedGiftTypeID = 0xd5c6969b

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeUpgradedGift) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeUpgradedGift{}
)

func (i *InternalLinkTypeUpgradedGift) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Name == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeUpgradedGift) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeUpgradedGift",
		ID:   InternalLinkTypeUpgradedGiftTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Name",
			SchemaName: "name",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeUpgradedGift) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUpgradedGift#d5c6969b as nil")
	}
	b.PutID(InternalLinkTypeUpgradedGiftTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeUpgradedGift) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUpgradedGift#d5c6969b as nil")
	}
	b.PutString(i.Name)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeUpgradedGift) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUpgradedGift#d5c6969b to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeUpgradedGift#d5c6969b: field name: %w", err)
		}
		i.Name = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeUpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUpgradedGift#d5c6969b as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeUpgradedGift")
	b.Comma()
	b.FieldStart("name")
	b.PutString(i.Name)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeUpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUpgradedGift#d5c6969b to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeUpgradedGift"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUpgradedGift#d5c6969b: %w", err)
			}
		case "name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUpgradedGift#d5c6969b: field name: %w", err)
			}
			i.Name = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetName returns value of Name field.
func (i *InternalLinkTypeUpgradedGift) GetName() (value string) {
	if i == nil {
		return
	}
	return i.Name
}

// InternalLinkTypeUserPhoneNumber represents TL type `internalLinkTypeUserPhoneNumber#104bbb08`.
type InternalLinkTypeUserPhoneNumber struct {
	// Phone number of the user
	PhoneNumber string
	// Draft text for message to send in the chat
	DraftText string
	// True, if user's profile information screen must be opened; otherwise, the chat itself
	// must be opened
	OpenProfile bool
}

// InternalLinkTypeUserPhoneNumberTypeID is TL type id of InternalLinkTypeUserPhoneNumber.
const InternalLinkTypeUserPhoneNumberTypeID = 0x104bbb08

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeUserPhoneNumber) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeUserPhoneNumber{}
)

func (i *InternalLinkTypeUserPhoneNumber) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.PhoneNumber == "") {
		return false
	}
	if !(i.DraftText == "") {
		return false
	}
	if !(i.OpenProfile == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeUserPhoneNumber) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeUserPhoneNumber",
		ID:   InternalLinkTypeUserPhoneNumberTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "DraftText",
			SchemaName: "draft_text",
		},
		{
			Name:       "OpenProfile",
			SchemaName: "open_profile",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeUserPhoneNumber) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil")
	}
	b.PutID(InternalLinkTypeUserPhoneNumberTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeUserPhoneNumber) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil")
	}
	b.PutString(i.PhoneNumber)
	b.PutString(i.DraftText)
	b.PutBool(i.OpenProfile)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeUserPhoneNumber) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeUserPhoneNumberTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeUserPhoneNumber) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field phone_number: %w", err)
		}
		i.PhoneNumber = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field draft_text: %w", err)
		}
		i.DraftText = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field open_profile: %w", err)
		}
		i.OpenProfile = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeUserPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeUserPhoneNumber")
	b.Comma()
	b.FieldStart("phone_number")
	b.PutString(i.PhoneNumber)
	b.Comma()
	b.FieldStart("draft_text")
	b.PutString(i.DraftText)
	b.Comma()
	b.FieldStart("open_profile")
	b.PutBool(i.OpenProfile)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeUserPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeUserPhoneNumber"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: %w", err)
			}
		case "phone_number":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field phone_number: %w", err)
			}
			i.PhoneNumber = value
		case "draft_text":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field draft_text: %w", err)
			}
			i.DraftText = value
		case "open_profile":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field open_profile: %w", err)
			}
			i.OpenProfile = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetPhoneNumber returns value of PhoneNumber field.
func (i *InternalLinkTypeUserPhoneNumber) GetPhoneNumber() (value string) {
	if i == nil {
		return
	}
	return i.PhoneNumber
}

// GetDraftText returns value of DraftText field.
func (i *InternalLinkTypeUserPhoneNumber) GetDraftText() (value string) {
	if i == nil {
		return
	}
	return i.DraftText
}

// GetOpenProfile returns value of OpenProfile field.
func (i *InternalLinkTypeUserPhoneNumber) GetOpenProfile() (value bool) {
	if i == nil {
		return
	}
	return i.OpenProfile
}

// InternalLinkTypeUserToken represents TL type `internalLinkTypeUserToken#a8d7db59`.
type InternalLinkTypeUserToken struct {
	// The token
	Token string
}

// InternalLinkTypeUserTokenTypeID is TL type id of InternalLinkTypeUserToken.
const InternalLinkTypeUserTokenTypeID = 0xa8d7db59

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeUserToken) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeUserToken{}
)

func (i *InternalLinkTypeUserToken) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.Token == "") {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeUserToken) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeUserToken",
		ID:   InternalLinkTypeUserTokenTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "Token",
			SchemaName: "token",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeUserToken) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil")
	}
	b.PutID(InternalLinkTypeUserTokenTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeUserToken) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil")
	}
	b.PutString(i.Token)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeUserToken) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUserToken#a8d7db59 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: field token: %w", err)
		}
		i.Token = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeUserToken) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeUserToken")
	b.Comma()
	b.FieldStart("token")
	b.PutString(i.Token)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeUserToken) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeUserToken#a8d7db59 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeUserToken"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: %w", err)
			}
		case "token":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: field token: %w", err)
			}
			i.Token = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetToken returns value of Token field.
func (i *InternalLinkTypeUserToken) GetToken() (value string) {
	if i == nil {
		return
	}
	return i.Token
}

// InternalLinkTypeVideoChat represents TL type `internalLinkTypeVideoChat#8796f8b4`.
type InternalLinkTypeVideoChat struct {
	// Username of the chat with the video chat
	ChatUsername string
	// If non-empty, invite hash to be used to join the video chat without being muted by
	// administrators
	InviteHash string
	// True, if the video chat is expected to be a live stream in a channel or a broadcast
	// group
	IsLiveStream bool
}

// InternalLinkTypeVideoChatTypeID is TL type id of InternalLinkTypeVideoChat.
const InternalLinkTypeVideoChatTypeID = 0x8796f8b4

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeVideoChat) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeVideoChat{}
)

func (i *InternalLinkTypeVideoChat) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.ChatUsername == "") {
		return false
	}
	if !(i.InviteHash == "") {
		return false
	}
	if !(i.IsLiveStream == false) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeVideoChat) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeVideoChat",
		ID:   InternalLinkTypeVideoChatTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "ChatUsername",
			SchemaName: "chat_username",
		},
		{
			Name:       "InviteHash",
			SchemaName: "invite_hash",
		},
		{
			Name:       "IsLiveStream",
			SchemaName: "is_live_stream",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeVideoChat) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeVideoChat#8796f8b4 as nil")
	}
	b.PutID(InternalLinkTypeVideoChatTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeVideoChat) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeVideoChat#8796f8b4 as nil")
	}
	b.PutString(i.ChatUsername)
	b.PutString(i.InviteHash)
	b.PutBool(i.IsLiveStream)
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeVideoChat) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeVideoChat#8796f8b4 to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeVideoChatTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeVideoChat) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeVideoChat#8796f8b4 to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field chat_username: %w", err)
		}
		i.ChatUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field invite_hash: %w", err)
		}
		i.InviteHash = value
	}
	{
		value, err := b.Bool()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field is_live_stream: %w", err)
		}
		i.IsLiveStream = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeVideoChat) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeVideoChat#8796f8b4 as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeVideoChat")
	b.Comma()
	b.FieldStart("chat_username")
	b.PutString(i.ChatUsername)
	b.Comma()
	b.FieldStart("invite_hash")
	b.PutString(i.InviteHash)
	b.Comma()
	b.FieldStart("is_live_stream")
	b.PutBool(i.IsLiveStream)
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeVideoChat) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeVideoChat#8796f8b4 to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeVideoChat"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: %w", err)
			}
		case "chat_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field chat_username: %w", err)
			}
			i.ChatUsername = value
		case "invite_hash":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field invite_hash: %w", err)
			}
			i.InviteHash = value
		case "is_live_stream":
			value, err := b.Bool()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field is_live_stream: %w", err)
			}
			i.IsLiveStream = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetChatUsername returns value of ChatUsername field.
func (i *InternalLinkTypeVideoChat) GetChatUsername() (value string) {
	if i == nil {
		return
	}
	return i.ChatUsername
}

// GetInviteHash returns value of InviteHash field.
func (i *InternalLinkTypeVideoChat) GetInviteHash() (value string) {
	if i == nil {
		return
	}
	return i.InviteHash
}

// GetIsLiveStream returns value of IsLiveStream field.
func (i *InternalLinkTypeVideoChat) GetIsLiveStream() (value bool) {
	if i == nil {
		return
	}
	return i.IsLiveStream
}

// InternalLinkTypeWebApp represents TL type `internalLinkTypeWebApp#7ae9552d`.
type InternalLinkTypeWebApp struct {
	// Username of the bot that owns the Web App
	BotUsername string
	// Short name of the Web App
	WebAppShortName string
	// Start parameter to be passed to getWebAppLinkUrl
	StartParameter string
	// The mode in which the Web App must be opened
	Mode WebAppOpenModeClass
}

// InternalLinkTypeWebAppTypeID is TL type id of InternalLinkTypeWebApp.
const InternalLinkTypeWebAppTypeID = 0x7ae9552d

// construct implements constructor of InternalLinkTypeClass.
func (i InternalLinkTypeWebApp) construct() InternalLinkTypeClass { return &i }

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

	_ InternalLinkTypeClass = &InternalLinkTypeWebApp{}
)

func (i *InternalLinkTypeWebApp) Zero() bool {
	if i == nil {
		return true
	}
	if !(i.BotUsername == "") {
		return false
	}
	if !(i.WebAppShortName == "") {
		return false
	}
	if !(i.StartParameter == "") {
		return false
	}
	if !(i.Mode == nil) {
		return false
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (i *InternalLinkTypeWebApp) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "internalLinkTypeWebApp",
		ID:   InternalLinkTypeWebAppTypeID,
	}
	if i == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{
		{
			Name:       "BotUsername",
			SchemaName: "bot_username",
		},
		{
			Name:       "WebAppShortName",
			SchemaName: "web_app_short_name",
		},
		{
			Name:       "StartParameter",
			SchemaName: "start_parameter",
		},
		{
			Name:       "Mode",
			SchemaName: "mode",
		},
	}
	return typ
}

// Encode implements bin.Encoder.
func (i *InternalLinkTypeWebApp) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeWebApp#7ae9552d as nil")
	}
	b.PutID(InternalLinkTypeWebAppTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InternalLinkTypeWebApp) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeWebApp#7ae9552d as nil")
	}
	b.PutString(i.BotUsername)
	b.PutString(i.WebAppShortName)
	b.PutString(i.StartParameter)
	if i.Mode == nil {
		return fmt.Errorf("unable to encode internalLinkTypeWebApp#7ae9552d: field mode is nil")
	}
	if err := i.Mode.Encode(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeWebApp#7ae9552d: field mode: %w", err)
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InternalLinkTypeWebApp) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeWebApp#7ae9552d to nil")
	}
	if err := b.ConsumeID(InternalLinkTypeWebAppTypeID); err != nil {
		return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InternalLinkTypeWebApp) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeWebApp#7ae9552d to nil")
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field bot_username: %w", err)
		}
		i.BotUsername = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field web_app_short_name: %w", err)
		}
		i.WebAppShortName = value
	}
	{
		value, err := b.String()
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field start_parameter: %w", err)
		}
		i.StartParameter = value
	}
	{
		value, err := DecodeWebAppOpenMode(b)
		if err != nil {
			return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field mode: %w", err)
		}
		i.Mode = value
	}
	return nil
}

// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (i *InternalLinkTypeWebApp) EncodeTDLibJSON(b tdjson.Encoder) error {
	if i == nil {
		return fmt.Errorf("can't encode internalLinkTypeWebApp#7ae9552d as nil")
	}
	b.ObjStart()
	b.PutID("internalLinkTypeWebApp")
	b.Comma()
	b.FieldStart("bot_username")
	b.PutString(i.BotUsername)
	b.Comma()
	b.FieldStart("web_app_short_name")
	b.PutString(i.WebAppShortName)
	b.Comma()
	b.FieldStart("start_parameter")
	b.PutString(i.StartParameter)
	b.Comma()
	b.FieldStart("mode")
	if i.Mode == nil {
		return fmt.Errorf("unable to encode internalLinkTypeWebApp#7ae9552d: field mode is nil")
	}
	if err := i.Mode.EncodeTDLibJSON(b); err != nil {
		return fmt.Errorf("unable to encode internalLinkTypeWebApp#7ae9552d: field mode: %w", err)
	}
	b.Comma()
	b.StripComma()
	b.ObjEnd()
	return nil
}

// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (i *InternalLinkTypeWebApp) DecodeTDLibJSON(b tdjson.Decoder) error {
	if i == nil {
		return fmt.Errorf("can't decode internalLinkTypeWebApp#7ae9552d to nil")
	}

	return b.Obj(func(b tdjson.Decoder, key []byte) error {
		switch string(key) {
		case tdjson.TypeField:
			if err := b.ConsumeID("internalLinkTypeWebApp"); err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: %w", err)
			}
		case "bot_username":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field bot_username: %w", err)
			}
			i.BotUsername = value
		case "web_app_short_name":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field web_app_short_name: %w", err)
			}
			i.WebAppShortName = value
		case "start_parameter":
			value, err := b.String()
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field start_parameter: %w", err)
			}
			i.StartParameter = value
		case "mode":
			value, err := DecodeTDLibJSONWebAppOpenMode(b)
			if err != nil {
				return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field mode: %w", err)
			}
			i.Mode = value
		default:
			return b.Skip()
		}
		return nil
	})
}

// GetBotUsername returns value of BotUsername field.
func (i *InternalLinkTypeWebApp) GetBotUsername() (value string) {
	if i == nil {
		return
	}
	return i.BotUsername
}

// GetWebAppShortName returns value of WebAppShortName field.
func (i *InternalLinkTypeWebApp) GetWebAppShortName() (value string) {
	if i == nil {
		return
	}
	return i.WebAppShortName
}

// GetStartParameter returns value of StartParameter field.
func (i *InternalLinkTypeWebApp) GetStartParameter() (value string) {
	if i == nil {
		return
	}
	return i.StartParameter
}

// GetMode returns value of Mode field.
func (i *InternalLinkTypeWebApp) GetMode() (value WebAppOpenModeClass) {
	if i == nil {
		return
	}
	return i.Mode
}

// InternalLinkTypeClassName is schema name of InternalLinkTypeClass.
const InternalLinkTypeClassName = "InternalLinkType"

// InternalLinkTypeClass represents InternalLinkType generic type.
//
// Example:
//
//	g, err := tdapi.DecodeInternalLinkType(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tdapi.InternalLinkTypeActiveSessions: // internalLinkTypeActiveSessions#706bbbad
//	case *tdapi.InternalLinkTypeAttachmentMenuBot: // internalLinkTypeAttachmentMenuBot#644c4225
//	case *tdapi.InternalLinkTypeAuthenticationCode: // internalLinkTypeAuthenticationCode#f3874ff2
//	case *tdapi.InternalLinkTypeBackground: // internalLinkTypeBackground#b0d2908
//	case *tdapi.InternalLinkTypeBotAddToChannel: // internalLinkTypeBotAddToChannel#538ac2c0
//	case *tdapi.InternalLinkTypeBotStart: // internalLinkTypeBotStart#3f985fed
//	case *tdapi.InternalLinkTypeBotStartInGroup: // internalLinkTypeBotStartInGroup#ca0d8cce
//	case *tdapi.InternalLinkTypeBusinessChat: // internalLinkTypeBusinessChat#a03ae9d7
//	case *tdapi.InternalLinkTypeBuyStars: // internalLinkTypeBuyStars#a94cc347
//	case *tdapi.InternalLinkTypeChangePhoneNumber: // internalLinkTypeChangePhoneNumber#f0275b01
//	case *tdapi.InternalLinkTypeChatAffiliateProgram: // internalLinkTypeChatAffiliateProgram#25ac5024
//	case *tdapi.InternalLinkTypeChatBoost: // internalLinkTypeChatBoost#d549fd40
//	case *tdapi.InternalLinkTypeChatFolderInvite: // internalLinkTypeChatFolderInvite#89b2493e
//	case *tdapi.InternalLinkTypeChatFolderSettings: // internalLinkTypeChatFolderSettings#bfff055c
//	case *tdapi.InternalLinkTypeChatInvite: // internalLinkTypeChatInvite#198c3cd9
//	case *tdapi.InternalLinkTypeDefaultMessageAutoDeleteTimerSettings: // internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931
//	case *tdapi.InternalLinkTypeEditProfileSettings: // internalLinkTypeEditProfileSettings#c30e5066
//	case *tdapi.InternalLinkTypeGame: // internalLinkTypeGame#f074adcd
//	case *tdapi.InternalLinkTypeGroupCall: // internalLinkTypeGroupCall#7469b416
//	case *tdapi.InternalLinkTypeInstantView: // internalLinkTypeInstantView#69e4df3f
//	case *tdapi.InternalLinkTypeInvoice: // internalLinkTypeInvoice#f34c6dac
//	case *tdapi.InternalLinkTypeLanguagePack: // internalLinkTypeLanguagePack#a9870d6c
//	case *tdapi.InternalLinkTypeLanguageSettings: // internalLinkTypeLanguageSettings#b019e6e6
//	case *tdapi.InternalLinkTypeMainWebApp: // internalLinkTypeMainWebApp#5ddf72e9
//	case *tdapi.InternalLinkTypeMessage: // internalLinkTypeMessage#3a535c52
//	case *tdapi.InternalLinkTypeMessageDraft: // internalLinkTypeMessageDraft#276fbad5
//	case *tdapi.InternalLinkTypeMyStars: // internalLinkTypeMyStars#6031f65e
//	case *tdapi.InternalLinkTypePassportDataRequest: // internalLinkTypePassportDataRequest#c50fce81
//	case *tdapi.InternalLinkTypePhoneNumberConfirmation: // internalLinkTypePhoneNumberConfirmation#68bf6b16
//	case *tdapi.InternalLinkTypePremiumFeatures: // internalLinkTypePremiumFeatures#48884f49
//	case *tdapi.InternalLinkTypePremiumGift: // internalLinkTypePremiumGift#5ad56d41
//	case *tdapi.InternalLinkTypePremiumGiftCode: // internalLinkTypePremiumGiftCode#de5c9892
//	case *tdapi.InternalLinkTypePrivacyAndSecuritySettings: // internalLinkTypePrivacyAndSecuritySettings#ad5f6acf
//	case *tdapi.InternalLinkTypeProxy: // internalLinkTypeProxy#b1b12cea
//	case *tdapi.InternalLinkTypePublicChat: // internalLinkTypePublicChat#697a2d00
//	case *tdapi.InternalLinkTypeQrCodeAuthentication: // internalLinkTypeQrCodeAuthentication#bf121924
//	case *tdapi.InternalLinkTypeRestorePurchases: // internalLinkTypeRestorePurchases#24203483
//	case *tdapi.InternalLinkTypeSettings: // internalLinkTypeSettings#177545b4
//	case *tdapi.InternalLinkTypeStickerSet: // internalLinkTypeStickerSet#a1464fa2
//	case *tdapi.InternalLinkTypeStory: // internalLinkTypeStory#6e63ee75
//	case *tdapi.InternalLinkTypeTheme: // internalLinkTypeTheme#f405f807
//	case *tdapi.InternalLinkTypeThemeSettings: // internalLinkTypeThemeSettings#c14d3916
//	case *tdapi.InternalLinkTypeUnknownDeepLink: // internalLinkTypeUnknownDeepLink#2549d7db
//	case *tdapi.InternalLinkTypeUnsupportedProxy: // internalLinkTypeUnsupportedProxy#de399f09
//	case *tdapi.InternalLinkTypeUpgradedGift: // internalLinkTypeUpgradedGift#d5c6969b
//	case *tdapi.InternalLinkTypeUserPhoneNumber: // internalLinkTypeUserPhoneNumber#104bbb08
//	case *tdapi.InternalLinkTypeUserToken: // internalLinkTypeUserToken#a8d7db59
//	case *tdapi.InternalLinkTypeVideoChat: // internalLinkTypeVideoChat#8796f8b4
//	case *tdapi.InternalLinkTypeWebApp: // internalLinkTypeWebApp#7ae9552d
//	default: panic(v)
//	}
type InternalLinkTypeClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InternalLinkTypeClass

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

	EncodeTDLibJSON(b tdjson.Encoder) error
	DecodeTDLibJSON(b tdjson.Decoder) error
}

// DecodeInternalLinkType implements binary de-serialization for InternalLinkTypeClass.
func DecodeInternalLinkType(buf *bin.Buffer) (InternalLinkTypeClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case InternalLinkTypeActiveSessionsTypeID:
		// Decoding internalLinkTypeActiveSessions#706bbbad.
		v := InternalLinkTypeActiveSessions{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeAttachmentMenuBotTypeID:
		// Decoding internalLinkTypeAttachmentMenuBot#644c4225.
		v := InternalLinkTypeAttachmentMenuBot{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeAuthenticationCodeTypeID:
		// Decoding internalLinkTypeAuthenticationCode#f3874ff2.
		v := InternalLinkTypeAuthenticationCode{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeBackgroundTypeID:
		// Decoding internalLinkTypeBackground#b0d2908.
		v := InternalLinkTypeBackground{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeBotAddToChannelTypeID:
		// Decoding internalLinkTypeBotAddToChannel#538ac2c0.
		v := InternalLinkTypeBotAddToChannel{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeBotStartTypeID:
		// Decoding internalLinkTypeBotStart#3f985fed.
		v := InternalLinkTypeBotStart{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeBotStartInGroupTypeID:
		// Decoding internalLinkTypeBotStartInGroup#ca0d8cce.
		v := InternalLinkTypeBotStartInGroup{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeBusinessChatTypeID:
		// Decoding internalLinkTypeBusinessChat#a03ae9d7.
		v := InternalLinkTypeBusinessChat{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeBuyStarsTypeID:
		// Decoding internalLinkTypeBuyStars#a94cc347.
		v := InternalLinkTypeBuyStars{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeChangePhoneNumberTypeID:
		// Decoding internalLinkTypeChangePhoneNumber#f0275b01.
		v := InternalLinkTypeChangePhoneNumber{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeChatAffiliateProgramTypeID:
		// Decoding internalLinkTypeChatAffiliateProgram#25ac5024.
		v := InternalLinkTypeChatAffiliateProgram{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeChatBoostTypeID:
		// Decoding internalLinkTypeChatBoost#d549fd40.
		v := InternalLinkTypeChatBoost{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeChatFolderInviteTypeID:
		// Decoding internalLinkTypeChatFolderInvite#89b2493e.
		v := InternalLinkTypeChatFolderInvite{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeChatFolderSettingsTypeID:
		// Decoding internalLinkTypeChatFolderSettings#bfff055c.
		v := InternalLinkTypeChatFolderSettings{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeChatInviteTypeID:
		// Decoding internalLinkTypeChatInvite#198c3cd9.
		v := InternalLinkTypeChatInvite{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID:
		// Decoding internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931.
		v := InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeEditProfileSettingsTypeID:
		// Decoding internalLinkTypeEditProfileSettings#c30e5066.
		v := InternalLinkTypeEditProfileSettings{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeGameTypeID:
		// Decoding internalLinkTypeGame#f074adcd.
		v := InternalLinkTypeGame{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeGroupCallTypeID:
		// Decoding internalLinkTypeGroupCall#7469b416.
		v := InternalLinkTypeGroupCall{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeInstantViewTypeID:
		// Decoding internalLinkTypeInstantView#69e4df3f.
		v := InternalLinkTypeInstantView{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeInvoiceTypeID:
		// Decoding internalLinkTypeInvoice#f34c6dac.
		v := InternalLinkTypeInvoice{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeLanguagePackTypeID:
		// Decoding internalLinkTypeLanguagePack#a9870d6c.
		v := InternalLinkTypeLanguagePack{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeLanguageSettingsTypeID:
		// Decoding internalLinkTypeLanguageSettings#b019e6e6.
		v := InternalLinkTypeLanguageSettings{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeMainWebAppTypeID:
		// Decoding internalLinkTypeMainWebApp#5ddf72e9.
		v := InternalLinkTypeMainWebApp{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeMessageTypeID:
		// Decoding internalLinkTypeMessage#3a535c52.
		v := InternalLinkTypeMessage{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeMessageDraftTypeID:
		// Decoding internalLinkTypeMessageDraft#276fbad5.
		v := InternalLinkTypeMessageDraft{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeMyStarsTypeID:
		// Decoding internalLinkTypeMyStars#6031f65e.
		v := InternalLinkTypeMyStars{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypePassportDataRequestTypeID:
		// Decoding internalLinkTypePassportDataRequest#c50fce81.
		v := InternalLinkTypePassportDataRequest{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypePhoneNumberConfirmationTypeID:
		// Decoding internalLinkTypePhoneNumberConfirmation#68bf6b16.
		v := InternalLinkTypePhoneNumberConfirmation{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypePremiumFeaturesTypeID:
		// Decoding internalLinkTypePremiumFeatures#48884f49.
		v := InternalLinkTypePremiumFeatures{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypePremiumGiftTypeID:
		// Decoding internalLinkTypePremiumGift#5ad56d41.
		v := InternalLinkTypePremiumGift{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypePremiumGiftCodeTypeID:
		// Decoding internalLinkTypePremiumGiftCode#de5c9892.
		v := InternalLinkTypePremiumGiftCode{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypePrivacyAndSecuritySettingsTypeID:
		// Decoding internalLinkTypePrivacyAndSecuritySettings#ad5f6acf.
		v := InternalLinkTypePrivacyAndSecuritySettings{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeProxyTypeID:
		// Decoding internalLinkTypeProxy#b1b12cea.
		v := InternalLinkTypeProxy{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypePublicChatTypeID:
		// Decoding internalLinkTypePublicChat#697a2d00.
		v := InternalLinkTypePublicChat{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeQrCodeAuthenticationTypeID:
		// Decoding internalLinkTypeQrCodeAuthentication#bf121924.
		v := InternalLinkTypeQrCodeAuthentication{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeRestorePurchasesTypeID:
		// Decoding internalLinkTypeRestorePurchases#24203483.
		v := InternalLinkTypeRestorePurchases{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeSettingsTypeID:
		// Decoding internalLinkTypeSettings#177545b4.
		v := InternalLinkTypeSettings{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeStickerSetTypeID:
		// Decoding internalLinkTypeStickerSet#a1464fa2.
		v := InternalLinkTypeStickerSet{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeStoryTypeID:
		// Decoding internalLinkTypeStory#6e63ee75.
		v := InternalLinkTypeStory{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeThemeTypeID:
		// Decoding internalLinkTypeTheme#f405f807.
		v := InternalLinkTypeTheme{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeThemeSettingsTypeID:
		// Decoding internalLinkTypeThemeSettings#c14d3916.
		v := InternalLinkTypeThemeSettings{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeUnknownDeepLinkTypeID:
		// Decoding internalLinkTypeUnknownDeepLink#2549d7db.
		v := InternalLinkTypeUnknownDeepLink{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeUnsupportedProxyTypeID:
		// Decoding internalLinkTypeUnsupportedProxy#de399f09.
		v := InternalLinkTypeUnsupportedProxy{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeUpgradedGiftTypeID:
		// Decoding internalLinkTypeUpgradedGift#d5c6969b.
		v := InternalLinkTypeUpgradedGift{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeUserPhoneNumberTypeID:
		// Decoding internalLinkTypeUserPhoneNumber#104bbb08.
		v := InternalLinkTypeUserPhoneNumber{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeUserTokenTypeID:
		// Decoding internalLinkTypeUserToken#a8d7db59.
		v := InternalLinkTypeUserToken{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeVideoChatTypeID:
		// Decoding internalLinkTypeVideoChat#8796f8b4.
		v := InternalLinkTypeVideoChat{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case InternalLinkTypeWebAppTypeID:
		// Decoding internalLinkTypeWebApp#7ae9552d.
		v := InternalLinkTypeWebApp{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", bin.NewUnexpectedID(id))
	}
}

// DecodeTDLibJSONInternalLinkType implements binary de-serialization for InternalLinkTypeClass.
func DecodeTDLibJSONInternalLinkType(buf tdjson.Decoder) (InternalLinkTypeClass, error) {
	id, err := buf.FindTypeID()
	if err != nil {
		return nil, err
	}
	switch id {
	case "internalLinkTypeActiveSessions":
		// Decoding internalLinkTypeActiveSessions#706bbbad.
		v := InternalLinkTypeActiveSessions{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeAttachmentMenuBot":
		// Decoding internalLinkTypeAttachmentMenuBot#644c4225.
		v := InternalLinkTypeAttachmentMenuBot{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeAuthenticationCode":
		// Decoding internalLinkTypeAuthenticationCode#f3874ff2.
		v := InternalLinkTypeAuthenticationCode{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeBackground":
		// Decoding internalLinkTypeBackground#b0d2908.
		v := InternalLinkTypeBackground{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeBotAddToChannel":
		// Decoding internalLinkTypeBotAddToChannel#538ac2c0.
		v := InternalLinkTypeBotAddToChannel{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeBotStart":
		// Decoding internalLinkTypeBotStart#3f985fed.
		v := InternalLinkTypeBotStart{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeBotStartInGroup":
		// Decoding internalLinkTypeBotStartInGroup#ca0d8cce.
		v := InternalLinkTypeBotStartInGroup{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeBusinessChat":
		// Decoding internalLinkTypeBusinessChat#a03ae9d7.
		v := InternalLinkTypeBusinessChat{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeBuyStars":
		// Decoding internalLinkTypeBuyStars#a94cc347.
		v := InternalLinkTypeBuyStars{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeChangePhoneNumber":
		// Decoding internalLinkTypeChangePhoneNumber#f0275b01.
		v := InternalLinkTypeChangePhoneNumber{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeChatAffiliateProgram":
		// Decoding internalLinkTypeChatAffiliateProgram#25ac5024.
		v := InternalLinkTypeChatAffiliateProgram{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeChatBoost":
		// Decoding internalLinkTypeChatBoost#d549fd40.
		v := InternalLinkTypeChatBoost{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeChatFolderInvite":
		// Decoding internalLinkTypeChatFolderInvite#89b2493e.
		v := InternalLinkTypeChatFolderInvite{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeChatFolderSettings":
		// Decoding internalLinkTypeChatFolderSettings#bfff055c.
		v := InternalLinkTypeChatFolderSettings{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeChatInvite":
		// Decoding internalLinkTypeChatInvite#198c3cd9.
		v := InternalLinkTypeChatInvite{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeDefaultMessageAutoDeleteTimerSettings":
		// Decoding internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931.
		v := InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeEditProfileSettings":
		// Decoding internalLinkTypeEditProfileSettings#c30e5066.
		v := InternalLinkTypeEditProfileSettings{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeGame":
		// Decoding internalLinkTypeGame#f074adcd.
		v := InternalLinkTypeGame{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeGroupCall":
		// Decoding internalLinkTypeGroupCall#7469b416.
		v := InternalLinkTypeGroupCall{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeInstantView":
		// Decoding internalLinkTypeInstantView#69e4df3f.
		v := InternalLinkTypeInstantView{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeInvoice":
		// Decoding internalLinkTypeInvoice#f34c6dac.
		v := InternalLinkTypeInvoice{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeLanguagePack":
		// Decoding internalLinkTypeLanguagePack#a9870d6c.
		v := InternalLinkTypeLanguagePack{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeLanguageSettings":
		// Decoding internalLinkTypeLanguageSettings#b019e6e6.
		v := InternalLinkTypeLanguageSettings{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeMainWebApp":
		// Decoding internalLinkTypeMainWebApp#5ddf72e9.
		v := InternalLinkTypeMainWebApp{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeMessage":
		// Decoding internalLinkTypeMessage#3a535c52.
		v := InternalLinkTypeMessage{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeMessageDraft":
		// Decoding internalLinkTypeMessageDraft#276fbad5.
		v := InternalLinkTypeMessageDraft{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeMyStars":
		// Decoding internalLinkTypeMyStars#6031f65e.
		v := InternalLinkTypeMyStars{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypePassportDataRequest":
		// Decoding internalLinkTypePassportDataRequest#c50fce81.
		v := InternalLinkTypePassportDataRequest{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypePhoneNumberConfirmation":
		// Decoding internalLinkTypePhoneNumberConfirmation#68bf6b16.
		v := InternalLinkTypePhoneNumberConfirmation{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypePremiumFeatures":
		// Decoding internalLinkTypePremiumFeatures#48884f49.
		v := InternalLinkTypePremiumFeatures{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypePremiumGift":
		// Decoding internalLinkTypePremiumGift#5ad56d41.
		v := InternalLinkTypePremiumGift{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypePremiumGiftCode":
		// Decoding internalLinkTypePremiumGiftCode#de5c9892.
		v := InternalLinkTypePremiumGiftCode{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypePrivacyAndSecuritySettings":
		// Decoding internalLinkTypePrivacyAndSecuritySettings#ad5f6acf.
		v := InternalLinkTypePrivacyAndSecuritySettings{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeProxy":
		// Decoding internalLinkTypeProxy#b1b12cea.
		v := InternalLinkTypeProxy{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypePublicChat":
		// Decoding internalLinkTypePublicChat#697a2d00.
		v := InternalLinkTypePublicChat{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeQrCodeAuthentication":
		// Decoding internalLinkTypeQrCodeAuthentication#bf121924.
		v := InternalLinkTypeQrCodeAuthentication{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeRestorePurchases":
		// Decoding internalLinkTypeRestorePurchases#24203483.
		v := InternalLinkTypeRestorePurchases{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeSettings":
		// Decoding internalLinkTypeSettings#177545b4.
		v := InternalLinkTypeSettings{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeStickerSet":
		// Decoding internalLinkTypeStickerSet#a1464fa2.
		v := InternalLinkTypeStickerSet{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeStory":
		// Decoding internalLinkTypeStory#6e63ee75.
		v := InternalLinkTypeStory{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeTheme":
		// Decoding internalLinkTypeTheme#f405f807.
		v := InternalLinkTypeTheme{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeThemeSettings":
		// Decoding internalLinkTypeThemeSettings#c14d3916.
		v := InternalLinkTypeThemeSettings{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeUnknownDeepLink":
		// Decoding internalLinkTypeUnknownDeepLink#2549d7db.
		v := InternalLinkTypeUnknownDeepLink{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeUnsupportedProxy":
		// Decoding internalLinkTypeUnsupportedProxy#de399f09.
		v := InternalLinkTypeUnsupportedProxy{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeUpgradedGift":
		// Decoding internalLinkTypeUpgradedGift#d5c6969b.
		v := InternalLinkTypeUpgradedGift{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeUserPhoneNumber":
		// Decoding internalLinkTypeUserPhoneNumber#104bbb08.
		v := InternalLinkTypeUserPhoneNumber{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeUserToken":
		// Decoding internalLinkTypeUserToken#a8d7db59.
		v := InternalLinkTypeUserToken{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeVideoChat":
		// Decoding internalLinkTypeVideoChat#8796f8b4.
		v := InternalLinkTypeVideoChat{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	case "internalLinkTypeWebApp":
		// Decoding internalLinkTypeWebApp#7ae9552d.
		v := InternalLinkTypeWebApp{}
		if err := v.DecodeTDLibJSON(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", tdjson.NewUnexpectedID(id))
	}
}

// InternalLinkType boxes the InternalLinkTypeClass providing a helper.
type InternalLinkTypeBox struct {
	InternalLinkType InternalLinkTypeClass
}

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

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

// DecodeTDLibJSON implements bin.Decoder for InternalLinkTypeBox.
func (b *InternalLinkTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error {
	if b == nil {
		return fmt.Errorf("unable to decode InternalLinkTypeBox to nil")
	}
	v, err := DecodeTDLibJSONInternalLinkType(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.InternalLinkType = v
	return nil
}

// EncodeTDLibJSON implements bin.Encode for InternalLinkTypeBox.
func (b *InternalLinkTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error {
	if b == nil || b.InternalLinkType == nil {
		return fmt.Errorf("unable to encode InternalLinkTypeClass as nil")
	}
	return b.InternalLinkType.EncodeTDLibJSON(buf)
}
