// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// TextEmpty represents TL type `textEmpty#dc3d824f`.
// Empty rich text element
//
// See https://core.telegram.org/constructor/textEmpty for reference.
type TextEmpty struct {
}

// TextEmptyTypeID is TL type id of TextEmpty.
const TextEmptyTypeID = 0xdc3d824f

// construct implements constructor of RichTextClass.
func ( TextEmpty) () RichTextClass { return & }

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

	_ RichTextClass = &TextEmpty{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *TextEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textEmpty#dc3d824f as nil")
	}
	.PutID(TextEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textEmpty#dc3d824f as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textEmpty#dc3d824f to nil")
	}
	return nil
}

// TextPlain represents TL type `textPlain#744694e0`.
// Plain text
//
// See https://core.telegram.org/constructor/textPlain for reference.
type TextPlain struct {
	// Text
	Text string
}

// TextPlainTypeID is TL type id of TextPlain.
const TextPlainTypeID = 0x744694e0

// construct implements constructor of RichTextClass.
func ( TextPlain) () RichTextClass { return & }

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

	_ RichTextClass = &TextPlain{}
)

func ( *TextPlain) () bool {
	if  == nil {
		return true
	}
	if !(.Text == "") {
		return false
	}

	return true
}

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

// FillFrom fills TextPlain from given interface.
func ( *TextPlain) ( interface {
	() ( string)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextPlain) () tdp.Type {
	 := tdp.Type{
		Name: "textPlain",
		ID:   TextPlainTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextPlain) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textPlain#744694e0 as nil")
	}
	.PutID(TextPlainTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextPlain) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textPlain#744694e0 as nil")
	}
	.PutString(.Text)
	return nil
}

// Decode implements bin.Decoder.
func ( *TextPlain) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textPlain#744694e0 to nil")
	}
	if  := .ConsumeID(TextPlainTypeID);  != nil {
		return fmt.Errorf("unable to decode textPlain#744694e0: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextPlain) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textPlain#744694e0 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode textPlain#744694e0: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextPlain) () ( string) {
	if  == nil {
		return
	}
	return .Text
}

// TextBold represents TL type `textBold#6724abc4`.
// Bold text
//
// See https://core.telegram.org/constructor/textBold for reference.
type TextBold struct {
	// Text
	Text RichTextClass
}

// TextBoldTypeID is TL type id of TextBold.
const TextBoldTypeID = 0x6724abc4

// construct implements constructor of RichTextClass.
func ( TextBold) () RichTextClass { return & }

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

	_ RichTextClass = &TextBold{}
)

func ( *TextBold) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextBold from given interface.
func ( *TextBold) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextBold) () tdp.Type {
	 := tdp.Type{
		Name: "textBold",
		ID:   TextBoldTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextBold) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textBold#6724abc4 as nil")
	}
	.PutID(TextBoldTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextBold) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textBold#6724abc4 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textBold#6724abc4: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textBold#6724abc4: field text: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *TextBold) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textBold#6724abc4 to nil")
	}
	if  := .ConsumeID(TextBoldTypeID);  != nil {
		return fmt.Errorf("unable to decode textBold#6724abc4: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextBold) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textBold#6724abc4 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textBold#6724abc4: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextBold) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextItalic represents TL type `textItalic#d912a59c`.
// Italic text
//
// See https://core.telegram.org/constructor/textItalic for reference.
type TextItalic struct {
	// Text
	Text RichTextClass
}

// TextItalicTypeID is TL type id of TextItalic.
const TextItalicTypeID = 0xd912a59c

// construct implements constructor of RichTextClass.
func ( TextItalic) () RichTextClass { return & }

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

	_ RichTextClass = &TextItalic{}
)

func ( *TextItalic) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextItalic from given interface.
func ( *TextItalic) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextItalic) () tdp.Type {
	 := tdp.Type{
		Name: "textItalic",
		ID:   TextItalicTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextItalic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textItalic#d912a59c as nil")
	}
	.PutID(TextItalicTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextItalic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textItalic#d912a59c as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textItalic#d912a59c: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textItalic#d912a59c: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextItalic) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textItalic#d912a59c to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textItalic#d912a59c: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextItalic) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextUnderline represents TL type `textUnderline#c12622c4`.
// Underlined text
//
// See https://core.telegram.org/constructor/textUnderline for reference.
type TextUnderline struct {
	// Text
	Text RichTextClass
}

// TextUnderlineTypeID is TL type id of TextUnderline.
const TextUnderlineTypeID = 0xc12622c4

// construct implements constructor of RichTextClass.
func ( TextUnderline) () RichTextClass { return & }

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

	_ RichTextClass = &TextUnderline{}
)

func ( *TextUnderline) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextUnderline from given interface.
func ( *TextUnderline) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextUnderline) () tdp.Type {
	 := tdp.Type{
		Name: "textUnderline",
		ID:   TextUnderlineTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextUnderline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textUnderline#c12622c4 as nil")
	}
	.PutID(TextUnderlineTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextUnderline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textUnderline#c12622c4 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textUnderline#c12622c4: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textUnderline#c12622c4: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextUnderline) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textUnderline#c12622c4 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textUnderline#c12622c4: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextUnderline) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextStrike represents TL type `textStrike#9bf8bb95`.
// Strikethrough text
//
// See https://core.telegram.org/constructor/textStrike for reference.
type TextStrike struct {
	// Text
	Text RichTextClass
}

// TextStrikeTypeID is TL type id of TextStrike.
const TextStrikeTypeID = 0x9bf8bb95

// construct implements constructor of RichTextClass.
func ( TextStrike) () RichTextClass { return & }

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

	_ RichTextClass = &TextStrike{}
)

func ( *TextStrike) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextStrike from given interface.
func ( *TextStrike) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextStrike) () tdp.Type {
	 := tdp.Type{
		Name: "textStrike",
		ID:   TextStrikeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextStrike) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textStrike#9bf8bb95 as nil")
	}
	.PutID(TextStrikeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextStrike) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textStrike#9bf8bb95 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textStrike#9bf8bb95: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textStrike#9bf8bb95: field text: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *TextStrike) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textStrike#9bf8bb95 to nil")
	}
	if  := .ConsumeID(TextStrikeTypeID);  != nil {
		return fmt.Errorf("unable to decode textStrike#9bf8bb95: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextStrike) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textStrike#9bf8bb95 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textStrike#9bf8bb95: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextStrike) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextFixed represents TL type `textFixed#6c3f19b9`.
// fixed-width rich text
//
// See https://core.telegram.org/constructor/textFixed for reference.
type TextFixed struct {
	// Text
	Text RichTextClass
}

// TextFixedTypeID is TL type id of TextFixed.
const TextFixedTypeID = 0x6c3f19b9

// construct implements constructor of RichTextClass.
func ( TextFixed) () RichTextClass { return & }

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

	_ RichTextClass = &TextFixed{}
)

func ( *TextFixed) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextFixed from given interface.
func ( *TextFixed) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextFixed) () tdp.Type {
	 := tdp.Type{
		Name: "textFixed",
		ID:   TextFixedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextFixed) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textFixed#6c3f19b9 as nil")
	}
	.PutID(TextFixedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextFixed) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textFixed#6c3f19b9 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textFixed#6c3f19b9: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textFixed#6c3f19b9: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextFixed) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textFixed#6c3f19b9 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textFixed#6c3f19b9: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextFixed) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextURL represents TL type `textUrl#3c2884c1`.
// Link
//
// See https://core.telegram.org/constructor/textUrl for reference.
type TextURL struct {
	// Text of link
	Text RichTextClass
	// Webpage HTTP URL
	URL string
	// If a preview was already generated for the page, the page ID
	WebpageID int64
}

// TextURLTypeID is TL type id of TextURL.
const TextURLTypeID = 0x3c2884c1

// construct implements constructor of RichTextClass.
func ( TextURL) () RichTextClass { return & }

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

	_ RichTextClass = &TextURL{}
)

func ( *TextURL) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.WebpageID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills TextURL from given interface.
func ( *TextURL) ( interface {
	() ( RichTextClass)
	() ( string)
	() ( int64)
}) {
	.Text = .()
	.URL = .()
	.WebpageID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextURL) () tdp.Type {
	 := tdp.Type{
		Name: "textUrl",
		ID:   TextURLTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "WebpageID",
			SchemaName: "webpage_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textUrl#3c2884c1 as nil")
	}
	.PutID(TextURLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textUrl#3c2884c1 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textUrl#3c2884c1: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textUrl#3c2884c1: field text: %w", )
	}
	.PutString(.URL)
	.PutLong(.WebpageID)
	return nil
}

// Decode implements bin.Decoder.
func ( *TextURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textUrl#3c2884c1 to nil")
	}
	if  := .ConsumeID(TextURLTypeID);  != nil {
		return fmt.Errorf("unable to decode textUrl#3c2884c1: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textUrl#3c2884c1 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textUrl#3c2884c1: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode textUrl#3c2884c1: field url: %w", )
		}
		.URL = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode textUrl#3c2884c1: field webpage_id: %w", )
		}
		.WebpageID = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextURL) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

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

// GetWebpageID returns value of WebpageID field.
func ( *TextURL) () ( int64) {
	if  == nil {
		return
	}
	return .WebpageID
}

// TextEmail represents TL type `textEmail#de5a0dd6`.
// Rich text email link
//
// See https://core.telegram.org/constructor/textEmail for reference.
type TextEmail struct {
	// Link text
	Text RichTextClass
	// Email address
	Email string
}

// TextEmailTypeID is TL type id of TextEmail.
const TextEmailTypeID = 0xde5a0dd6

// construct implements constructor of RichTextClass.
func ( TextEmail) () RichTextClass { return & }

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

	_ RichTextClass = &TextEmail{}
)

func ( *TextEmail) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}
	if !(.Email == "") {
		return false
	}

	return true
}

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

// FillFrom fills TextEmail from given interface.
func ( *TextEmail) ( interface {
	() ( RichTextClass)
	() ( string)
}) {
	.Text = .()
	.Email = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextEmail) () tdp.Type {
	 := tdp.Type{
		Name: "textEmail",
		ID:   TextEmailTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Email",
			SchemaName: "email",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextEmail) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textEmail#de5a0dd6 as nil")
	}
	.PutID(TextEmailTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextEmail) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textEmail#de5a0dd6 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textEmail#de5a0dd6: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textEmail#de5a0dd6: field text: %w", )
	}
	.PutString(.Email)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextEmail) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textEmail#de5a0dd6 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textEmail#de5a0dd6: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode textEmail#de5a0dd6: field email: %w", )
		}
		.Email = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextEmail) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// GetEmail returns value of Email field.
func ( *TextEmail) () ( string) {
	if  == nil {
		return
	}
	return .Email
}

// TextConcat represents TL type `textConcat#7e6260d7`.
// Concatenation of rich texts
//
// See https://core.telegram.org/constructor/textConcat for reference.
type TextConcat struct {
	// Concatenated rich texts
	Texts []RichTextClass
}

// TextConcatTypeID is TL type id of TextConcat.
const TextConcatTypeID = 0x7e6260d7

// construct implements constructor of RichTextClass.
func ( TextConcat) () RichTextClass { return & }

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

	_ RichTextClass = &TextConcat{}
)

func ( *TextConcat) () bool {
	if  == nil {
		return true
	}
	if !(.Texts == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextConcat from given interface.
func ( *TextConcat) ( interface {
	() ( []RichTextClass)
}) {
	.Texts = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextConcat) () tdp.Type {
	 := tdp.Type{
		Name: "textConcat",
		ID:   TextConcatTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Texts",
			SchemaName: "texts",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextConcat) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textConcat#7e6260d7 as nil")
	}
	.PutID(TextConcatTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextConcat) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textConcat#7e6260d7 as nil")
	}
	.PutVectorHeader(len(.Texts))
	for ,  := range .Texts {
		if  == nil {
			return fmt.Errorf("unable to encode textConcat#7e6260d7: field texts element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode textConcat#7e6260d7: field texts element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextConcat) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textConcat#7e6260d7 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode textConcat#7e6260d7: field texts: %w", )
		}

		if  > 0 {
			.Texts = make([]RichTextClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeRichText()
			if  != nil {
				return fmt.Errorf("unable to decode textConcat#7e6260d7: field texts: %w", )
			}
			.Texts = append(.Texts, )
		}
	}
	return nil
}

// GetTexts returns value of Texts field.
func ( *TextConcat) () ( []RichTextClass) {
	if  == nil {
		return
	}
	return .Texts
}

// MapTexts returns field Texts wrapped in RichTextClassArray helper.
func ( *TextConcat) () ( RichTextClassArray) {
	return RichTextClassArray(.Texts)
}

// TextSubscript represents TL type `textSubscript#ed6a8504`.
// Subscript text
//
// See https://core.telegram.org/constructor/textSubscript for reference.
type TextSubscript struct {
	// Text
	Text RichTextClass
}

// TextSubscriptTypeID is TL type id of TextSubscript.
const TextSubscriptTypeID = 0xed6a8504

// construct implements constructor of RichTextClass.
func ( TextSubscript) () RichTextClass { return & }

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

	_ RichTextClass = &TextSubscript{}
)

func ( *TextSubscript) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextSubscript from given interface.
func ( *TextSubscript) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextSubscript) () tdp.Type {
	 := tdp.Type{
		Name: "textSubscript",
		ID:   TextSubscriptTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextSubscript) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textSubscript#ed6a8504 as nil")
	}
	.PutID(TextSubscriptTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextSubscript) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textSubscript#ed6a8504 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textSubscript#ed6a8504: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textSubscript#ed6a8504: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextSubscript) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textSubscript#ed6a8504 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textSubscript#ed6a8504: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextSubscript) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextSuperscript represents TL type `textSuperscript#c7fb5e01`.
// Superscript text
//
// See https://core.telegram.org/constructor/textSuperscript for reference.
type TextSuperscript struct {
	// Text
	Text RichTextClass
}

// TextSuperscriptTypeID is TL type id of TextSuperscript.
const TextSuperscriptTypeID = 0xc7fb5e01

// construct implements constructor of RichTextClass.
func ( TextSuperscript) () RichTextClass { return & }

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

	_ RichTextClass = &TextSuperscript{}
)

func ( *TextSuperscript) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextSuperscript from given interface.
func ( *TextSuperscript) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextSuperscript) () tdp.Type {
	 := tdp.Type{
		Name: "textSuperscript",
		ID:   TextSuperscriptTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextSuperscript) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textSuperscript#c7fb5e01 as nil")
	}
	.PutID(TextSuperscriptTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextSuperscript) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textSuperscript#c7fb5e01 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textSuperscript#c7fb5e01: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textSuperscript#c7fb5e01: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextSuperscript) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textSuperscript#c7fb5e01 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textSuperscript#c7fb5e01: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextSuperscript) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextMarked represents TL type `textMarked#34b8621`.
// Highlighted text
//
// See https://core.telegram.org/constructor/textMarked for reference.
type TextMarked struct {
	// Text
	Text RichTextClass
}

// TextMarkedTypeID is TL type id of TextMarked.
const TextMarkedTypeID = 0x34b8621

// construct implements constructor of RichTextClass.
func ( TextMarked) () RichTextClass { return & }

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

	_ RichTextClass = &TextMarked{}
)

func ( *TextMarked) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextMarked from given interface.
func ( *TextMarked) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextMarked) () tdp.Type {
	 := tdp.Type{
		Name: "textMarked",
		ID:   TextMarkedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextMarked) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textMarked#34b8621 as nil")
	}
	.PutID(TextMarkedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextMarked) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textMarked#34b8621 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textMarked#34b8621: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textMarked#34b8621: field text: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *TextMarked) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textMarked#34b8621 to nil")
	}
	if  := .ConsumeID(TextMarkedTypeID);  != nil {
		return fmt.Errorf("unable to decode textMarked#34b8621: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextMarked) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textMarked#34b8621 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textMarked#34b8621: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextMarked) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextPhone represents TL type `textPhone#1ccb966a`.
// Rich text linked to a phone number
//
// See https://core.telegram.org/constructor/textPhone for reference.
type TextPhone struct {
	// Text
	Text RichTextClass
	// Phone number
	Phone string
}

// TextPhoneTypeID is TL type id of TextPhone.
const TextPhoneTypeID = 0x1ccb966a

// construct implements constructor of RichTextClass.
func ( TextPhone) () RichTextClass { return & }

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

	_ RichTextClass = &TextPhone{}
)

func ( *TextPhone) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}
	if !(.Phone == "") {
		return false
	}

	return true
}

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

// FillFrom fills TextPhone from given interface.
func ( *TextPhone) ( interface {
	() ( RichTextClass)
	() ( string)
}) {
	.Text = .()
	.Phone = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextPhone) () tdp.Type {
	 := tdp.Type{
		Name: "textPhone",
		ID:   TextPhoneTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Phone",
			SchemaName: "phone",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textPhone#1ccb966a as nil")
	}
	.PutID(TextPhoneTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textPhone#1ccb966a as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textPhone#1ccb966a: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textPhone#1ccb966a: field text: %w", )
	}
	.PutString(.Phone)
	return nil
}

// Decode implements bin.Decoder.
func ( *TextPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textPhone#1ccb966a to nil")
	}
	if  := .ConsumeID(TextPhoneTypeID);  != nil {
		return fmt.Errorf("unable to decode textPhone#1ccb966a: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textPhone#1ccb966a to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textPhone#1ccb966a: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode textPhone#1ccb966a: field phone: %w", )
		}
		.Phone = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextPhone) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// GetPhone returns value of Phone field.
func ( *TextPhone) () ( string) {
	if  == nil {
		return
	}
	return .Phone
}

// TextImage represents TL type `textImage#81ccf4f`.
// Inline image
//
// See https://core.telegram.org/constructor/textImage for reference.
type TextImage struct {
	// Document ID
	DocumentID int64
	// Width
	W int
	// Height
	H int
}

// TextImageTypeID is TL type id of TextImage.
const TextImageTypeID = 0x81ccf4f

// construct implements constructor of RichTextClass.
func ( TextImage) () RichTextClass { return & }

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

	_ RichTextClass = &TextImage{}
)

func ( *TextImage) () bool {
	if  == nil {
		return true
	}
	if !(.DocumentID == 0) {
		return false
	}
	if !(.W == 0) {
		return false
	}
	if !(.H == 0) {
		return false
	}

	return true
}

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

// FillFrom fills TextImage from given interface.
func ( *TextImage) ( interface {
	() ( int64)
	() ( int)
	() ( int)
}) {
	.DocumentID = .()
	.W = .()
	.H = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextImage) () tdp.Type {
	 := tdp.Type{
		Name: "textImage",
		ID:   TextImageTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "DocumentID",
			SchemaName: "document_id",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextImage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textImage#81ccf4f as nil")
	}
	.PutID(TextImageTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextImage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textImage#81ccf4f as nil")
	}
	.PutLong(.DocumentID)
	.PutInt(.W)
	.PutInt(.H)
	return nil
}

// Decode implements bin.Decoder.
func ( *TextImage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textImage#81ccf4f to nil")
	}
	if  := .ConsumeID(TextImageTypeID);  != nil {
		return fmt.Errorf("unable to decode textImage#81ccf4f: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextImage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textImage#81ccf4f to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode textImage#81ccf4f: field document_id: %w", )
		}
		.DocumentID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode textImage#81ccf4f: field w: %w", )
		}
		.W = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode textImage#81ccf4f: field h: %w", )
		}
		.H = 
	}
	return nil
}

// GetDocumentID returns value of DocumentID field.
func ( *TextImage) () ( int64) {
	if  == nil {
		return
	}
	return .DocumentID
}

// GetW returns value of W field.
func ( *TextImage) () ( int) {
	if  == nil {
		return
	}
	return .W
}

// GetH returns value of H field.
func ( *TextImage) () ( int) {
	if  == nil {
		return
	}
	return .H
}

// TextAnchor represents TL type `textAnchor#35553762`.
// Text linking to another section of the page
//
// See https://core.telegram.org/constructor/textAnchor for reference.
type TextAnchor struct {
	// Text
	Text RichTextClass
	// Section name
	Name string
}

// TextAnchorTypeID is TL type id of TextAnchor.
const TextAnchorTypeID = 0x35553762

// construct implements constructor of RichTextClass.
func ( TextAnchor) () RichTextClass { return & }

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

	_ RichTextClass = &TextAnchor{}
)

func ( *TextAnchor) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}
	if !(.Name == "") {
		return false
	}

	return true
}

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

// FillFrom fills TextAnchor from given interface.
func ( *TextAnchor) ( interface {
	() ( RichTextClass)
	() ( string)
}) {
	.Text = .()
	.Name = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextAnchor) () tdp.Type {
	 := tdp.Type{
		Name: "textAnchor",
		ID:   TextAnchorTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Name",
			SchemaName: "name",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextAnchor) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textAnchor#35553762 as nil")
	}
	.PutID(TextAnchorTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextAnchor) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textAnchor#35553762 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textAnchor#35553762: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textAnchor#35553762: field text: %w", )
	}
	.PutString(.Name)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextAnchor) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textAnchor#35553762 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textAnchor#35553762: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode textAnchor#35553762: field name: %w", )
		}
		.Name = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextAnchor) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

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

// TextMath represents TL type `textMath#9d2eac97`.
//
// See https://core.telegram.org/constructor/textMath for reference.
type TextMath struct {
	// Source field of TextMath.
	Source string
}

// TextMathTypeID is TL type id of TextMath.
const TextMathTypeID = 0x9d2eac97

// construct implements constructor of RichTextClass.
func ( TextMath) () RichTextClass { return & }

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

	_ RichTextClass = &TextMath{}
)

func ( *TextMath) () bool {
	if  == nil {
		return true
	}
	if !(.Source == "") {
		return false
	}

	return true
}

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

// FillFrom fills TextMath from given interface.
func ( *TextMath) ( interface {
	() ( string)
}) {
	.Source = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextMath) () tdp.Type {
	 := tdp.Type{
		Name: "textMath",
		ID:   TextMathTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Source",
			SchemaName: "source",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextMath) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textMath#9d2eac97 as nil")
	}
	.PutID(TextMathTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextMath) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textMath#9d2eac97 as nil")
	}
	.PutString(.Source)
	return nil
}

// Decode implements bin.Decoder.
func ( *TextMath) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textMath#9d2eac97 to nil")
	}
	if  := .ConsumeID(TextMathTypeID);  != nil {
		return fmt.Errorf("unable to decode textMath#9d2eac97: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextMath) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textMath#9d2eac97 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode textMath#9d2eac97: field source: %w", )
		}
		.Source = 
	}
	return nil
}

// GetSource returns value of Source field.
func ( *TextMath) () ( string) {
	if  == nil {
		return
	}
	return .Source
}

// TextCustomEmoji represents TL type `textCustomEmoji#a26156c0`.
//
// See https://core.telegram.org/constructor/textCustomEmoji for reference.
type TextCustomEmoji struct {
	// DocumentID field of TextCustomEmoji.
	DocumentID int64
	// Alt field of TextCustomEmoji.
	Alt string
}

// TextCustomEmojiTypeID is TL type id of TextCustomEmoji.
const TextCustomEmojiTypeID = 0xa26156c0

// construct implements constructor of RichTextClass.
func ( TextCustomEmoji) () RichTextClass { return & }

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

	_ RichTextClass = &TextCustomEmoji{}
)

func ( *TextCustomEmoji) () bool {
	if  == nil {
		return true
	}
	if !(.DocumentID == 0) {
		return false
	}
	if !(.Alt == "") {
		return false
	}

	return true
}

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

// FillFrom fills TextCustomEmoji from given interface.
func ( *TextCustomEmoji) ( interface {
	() ( int64)
	() ( string)
}) {
	.DocumentID = .()
	.Alt = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextCustomEmoji) () tdp.Type {
	 := tdp.Type{
		Name: "textCustomEmoji",
		ID:   TextCustomEmojiTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "DocumentID",
			SchemaName: "document_id",
		},
		{
			Name:       "Alt",
			SchemaName: "alt",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextCustomEmoji) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textCustomEmoji#a26156c0 as nil")
	}
	.PutID(TextCustomEmojiTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextCustomEmoji) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textCustomEmoji#a26156c0 as nil")
	}
	.PutLong(.DocumentID)
	.PutString(.Alt)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextCustomEmoji) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textCustomEmoji#a26156c0 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode textCustomEmoji#a26156c0: field document_id: %w", )
		}
		.DocumentID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode textCustomEmoji#a26156c0: field alt: %w", )
		}
		.Alt = 
	}
	return nil
}

// GetDocumentID returns value of DocumentID field.
func ( *TextCustomEmoji) () ( int64) {
	if  == nil {
		return
	}
	return .DocumentID
}

// GetAlt returns value of Alt field.
func ( *TextCustomEmoji) () ( string) {
	if  == nil {
		return
	}
	return .Alt
}

// TextSpoiler represents TL type `textSpoiler#4c2a5d62`.
//
// See https://core.telegram.org/constructor/textSpoiler for reference.
type TextSpoiler struct {
	// Text field of TextSpoiler.
	Text RichTextClass
}

// TextSpoilerTypeID is TL type id of TextSpoiler.
const TextSpoilerTypeID = 0x4c2a5d62

// construct implements constructor of RichTextClass.
func ( TextSpoiler) () RichTextClass { return & }

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

	_ RichTextClass = &TextSpoiler{}
)

func ( *TextSpoiler) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextSpoiler from given interface.
func ( *TextSpoiler) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextSpoiler) () tdp.Type {
	 := tdp.Type{
		Name: "textSpoiler",
		ID:   TextSpoilerTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextSpoiler) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textSpoiler#4c2a5d62 as nil")
	}
	.PutID(TextSpoilerTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextSpoiler) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textSpoiler#4c2a5d62 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textSpoiler#4c2a5d62: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textSpoiler#4c2a5d62: field text: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *TextSpoiler) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textSpoiler#4c2a5d62 to nil")
	}
	if  := .ConsumeID(TextSpoilerTypeID);  != nil {
		return fmt.Errorf("unable to decode textSpoiler#4c2a5d62: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextSpoiler) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textSpoiler#4c2a5d62 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textSpoiler#4c2a5d62: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextSpoiler) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextMention represents TL type `textMention#cd24cf44`.
//
// See https://core.telegram.org/constructor/textMention for reference.
type TextMention struct {
	// Text field of TextMention.
	Text RichTextClass
}

// TextMentionTypeID is TL type id of TextMention.
const TextMentionTypeID = 0xcd24cf44

// construct implements constructor of RichTextClass.
func ( TextMention) () RichTextClass { return & }

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

	_ RichTextClass = &TextMention{}
)

func ( *TextMention) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextMention from given interface.
func ( *TextMention) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextMention) () tdp.Type {
	 := tdp.Type{
		Name: "textMention",
		ID:   TextMentionTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextMention) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textMention#cd24cf44 as nil")
	}
	.PutID(TextMentionTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextMention) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textMention#cd24cf44 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textMention#cd24cf44: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textMention#cd24cf44: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextMention) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textMention#cd24cf44 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textMention#cd24cf44: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextMention) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextHashtag represents TL type `textHashtag#519524ea`.
//
// See https://core.telegram.org/constructor/textHashtag for reference.
type TextHashtag struct {
	// Text field of TextHashtag.
	Text RichTextClass
}

// TextHashtagTypeID is TL type id of TextHashtag.
const TextHashtagTypeID = 0x519524ea

// construct implements constructor of RichTextClass.
func ( TextHashtag) () RichTextClass { return & }

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

	_ RichTextClass = &TextHashtag{}
)

func ( *TextHashtag) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextHashtag from given interface.
func ( *TextHashtag) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextHashtag) () tdp.Type {
	 := tdp.Type{
		Name: "textHashtag",
		ID:   TextHashtagTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextHashtag) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textHashtag#519524ea as nil")
	}
	.PutID(TextHashtagTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextHashtag) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textHashtag#519524ea as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textHashtag#519524ea: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textHashtag#519524ea: field text: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *TextHashtag) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textHashtag#519524ea to nil")
	}
	if  := .ConsumeID(TextHashtagTypeID);  != nil {
		return fmt.Errorf("unable to decode textHashtag#519524ea: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextHashtag) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textHashtag#519524ea to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textHashtag#519524ea: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextHashtag) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextBotCommand represents TL type `textBotCommand#2ff29d3`.
//
// See https://core.telegram.org/constructor/textBotCommand for reference.
type TextBotCommand struct {
	// Text field of TextBotCommand.
	Text RichTextClass
}

// TextBotCommandTypeID is TL type id of TextBotCommand.
const TextBotCommandTypeID = 0x2ff29d3

// construct implements constructor of RichTextClass.
func ( TextBotCommand) () RichTextClass { return & }

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

	_ RichTextClass = &TextBotCommand{}
)

func ( *TextBotCommand) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextBotCommand from given interface.
func ( *TextBotCommand) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextBotCommand) () tdp.Type {
	 := tdp.Type{
		Name: "textBotCommand",
		ID:   TextBotCommandTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextBotCommand) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textBotCommand#2ff29d3 as nil")
	}
	.PutID(TextBotCommandTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextBotCommand) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textBotCommand#2ff29d3 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textBotCommand#2ff29d3: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textBotCommand#2ff29d3: field text: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *TextBotCommand) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textBotCommand#2ff29d3 to nil")
	}
	if  := .ConsumeID(TextBotCommandTypeID);  != nil {
		return fmt.Errorf("unable to decode textBotCommand#2ff29d3: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextBotCommand) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textBotCommand#2ff29d3 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textBotCommand#2ff29d3: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextBotCommand) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextCashtag represents TL type `textCashtag#7b9e1801`.
//
// See https://core.telegram.org/constructor/textCashtag for reference.
type TextCashtag struct {
	// Text field of TextCashtag.
	Text RichTextClass
}

// TextCashtagTypeID is TL type id of TextCashtag.
const TextCashtagTypeID = 0x7b9e1801

// construct implements constructor of RichTextClass.
func ( TextCashtag) () RichTextClass { return & }

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

	_ RichTextClass = &TextCashtag{}
)

func ( *TextCashtag) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextCashtag from given interface.
func ( *TextCashtag) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextCashtag) () tdp.Type {
	 := tdp.Type{
		Name: "textCashtag",
		ID:   TextCashtagTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextCashtag) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textCashtag#7b9e1801 as nil")
	}
	.PutID(TextCashtagTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextCashtag) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textCashtag#7b9e1801 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textCashtag#7b9e1801: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textCashtag#7b9e1801: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextCashtag) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textCashtag#7b9e1801 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textCashtag#7b9e1801: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextCashtag) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextAutoURL represents TL type `textAutoUrl#ac6a83aa`.
//
// See https://core.telegram.org/constructor/textAutoUrl for reference.
type TextAutoURL struct {
	// Text field of TextAutoURL.
	Text RichTextClass
}

// TextAutoURLTypeID is TL type id of TextAutoURL.
const TextAutoURLTypeID = 0xac6a83aa

// construct implements constructor of RichTextClass.
func ( TextAutoURL) () RichTextClass { return & }

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

	_ RichTextClass = &TextAutoURL{}
)

func ( *TextAutoURL) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextAutoURL from given interface.
func ( *TextAutoURL) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextAutoURL) () tdp.Type {
	 := tdp.Type{
		Name: "textAutoUrl",
		ID:   TextAutoURLTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextAutoURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textAutoUrl#ac6a83aa as nil")
	}
	.PutID(TextAutoURLTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextAutoURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textAutoUrl#ac6a83aa as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textAutoUrl#ac6a83aa: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textAutoUrl#ac6a83aa: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextAutoURL) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textAutoUrl#ac6a83aa to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textAutoUrl#ac6a83aa: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextAutoURL) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextAutoEmail represents TL type `textAutoEmail#c556a45d`.
//
// See https://core.telegram.org/constructor/textAutoEmail for reference.
type TextAutoEmail struct {
	// Text field of TextAutoEmail.
	Text RichTextClass
}

// TextAutoEmailTypeID is TL type id of TextAutoEmail.
const TextAutoEmailTypeID = 0xc556a45d

// construct implements constructor of RichTextClass.
func ( TextAutoEmail) () RichTextClass { return & }

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

	_ RichTextClass = &TextAutoEmail{}
)

func ( *TextAutoEmail) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextAutoEmail from given interface.
func ( *TextAutoEmail) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextAutoEmail) () tdp.Type {
	 := tdp.Type{
		Name: "textAutoEmail",
		ID:   TextAutoEmailTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextAutoEmail) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textAutoEmail#c556a45d as nil")
	}
	.PutID(TextAutoEmailTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextAutoEmail) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textAutoEmail#c556a45d as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textAutoEmail#c556a45d: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textAutoEmail#c556a45d: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextAutoEmail) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textAutoEmail#c556a45d to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textAutoEmail#c556a45d: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextAutoEmail) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextAutoPhone represents TL type `textAutoPhone#24c26789`.
//
// See https://core.telegram.org/constructor/textAutoPhone for reference.
type TextAutoPhone struct {
	// Text field of TextAutoPhone.
	Text RichTextClass
}

// TextAutoPhoneTypeID is TL type id of TextAutoPhone.
const TextAutoPhoneTypeID = 0x24c26789

// construct implements constructor of RichTextClass.
func ( TextAutoPhone) () RichTextClass { return & }

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

	_ RichTextClass = &TextAutoPhone{}
)

func ( *TextAutoPhone) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextAutoPhone from given interface.
func ( *TextAutoPhone) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextAutoPhone) () tdp.Type {
	 := tdp.Type{
		Name: "textAutoPhone",
		ID:   TextAutoPhoneTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextAutoPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textAutoPhone#24c26789 as nil")
	}
	.PutID(TextAutoPhoneTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextAutoPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textAutoPhone#24c26789 as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textAutoPhone#24c26789: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textAutoPhone#24c26789: field text: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *TextAutoPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textAutoPhone#24c26789 to nil")
	}
	if  := .ConsumeID(TextAutoPhoneTypeID);  != nil {
		return fmt.Errorf("unable to decode textAutoPhone#24c26789: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextAutoPhone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textAutoPhone#24c26789 to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textAutoPhone#24c26789: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextAutoPhone) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextBankCard represents TL type `textBankCard#b956812d`.
//
// See https://core.telegram.org/constructor/textBankCard for reference.
type TextBankCard struct {
	// Text field of TextBankCard.
	Text RichTextClass
}

// TextBankCardTypeID is TL type id of TextBankCard.
const TextBankCardTypeID = 0xb956812d

// construct implements constructor of RichTextClass.
func ( TextBankCard) () RichTextClass { return & }

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

	_ RichTextClass = &TextBankCard{}
)

func ( *TextBankCard) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}

	return true
}

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

// FillFrom fills TextBankCard from given interface.
func ( *TextBankCard) ( interface {
	() ( RichTextClass)
}) {
	.Text = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextBankCard) () tdp.Type {
	 := tdp.Type{
		Name: "textBankCard",
		ID:   TextBankCardTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextBankCard) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textBankCard#b956812d as nil")
	}
	.PutID(TextBankCardTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextBankCard) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textBankCard#b956812d as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textBankCard#b956812d: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textBankCard#b956812d: field text: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextBankCard) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textBankCard#b956812d to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textBankCard#b956812d: field text: %w", )
		}
		.Text = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextBankCard) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// TextMentionName represents TL type `textMentionName#1a9fbfc`.
//
// See https://core.telegram.org/constructor/textMentionName for reference.
type TextMentionName struct {
	// Text field of TextMentionName.
	Text RichTextClass
	// UserID field of TextMentionName.
	UserID int64
}

// TextMentionNameTypeID is TL type id of TextMentionName.
const TextMentionNameTypeID = 0x1a9fbfc

// construct implements constructor of RichTextClass.
func ( TextMentionName) () RichTextClass { return & }

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

	_ RichTextClass = &TextMentionName{}
)

func ( *TextMentionName) () bool {
	if  == nil {
		return true
	}
	if !(.Text == nil) {
		return false
	}
	if !(.UserID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills TextMentionName from given interface.
func ( *TextMentionName) ( interface {
	() ( RichTextClass)
	() ( int64)
}) {
	.Text = .()
	.UserID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextMentionName) () tdp.Type {
	 := tdp.Type{
		Name: "textMentionName",
		ID:   TextMentionNameTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *TextMentionName) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textMentionName#1a9fbfc as nil")
	}
	.PutID(TextMentionNameTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextMentionName) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textMentionName#1a9fbfc as nil")
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textMentionName#1a9fbfc: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textMentionName#1a9fbfc: field text: %w", )
	}
	.PutLong(.UserID)
	return nil
}

// Decode implements bin.Decoder.
func ( *TextMentionName) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textMentionName#1a9fbfc to nil")
	}
	if  := .ConsumeID(TextMentionNameTypeID);  != nil {
		return fmt.Errorf("unable to decode textMentionName#1a9fbfc: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *TextMentionName) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textMentionName#1a9fbfc to nil")
	}
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textMentionName#1a9fbfc: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode textMentionName#1a9fbfc: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// GetText returns value of Text field.
func ( *TextMentionName) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// GetUserID returns value of UserID field.
func ( *TextMentionName) () ( int64) {
	if  == nil {
		return
	}
	return .UserID
}

// TextDate represents TL type `textDate#a5b45e2b`.
//
// See https://core.telegram.org/constructor/textDate for reference.
type TextDate struct {
	// Flags field of TextDate.
	Flags bin.Fields
	// Relative field of TextDate.
	Relative bool
	// ShortTime field of TextDate.
	ShortTime bool
	// LongTime field of TextDate.
	LongTime bool
	// ShortDate field of TextDate.
	ShortDate bool
	// LongDate field of TextDate.
	LongDate bool
	// DayOfWeek field of TextDate.
	DayOfWeek bool
	// Text field of TextDate.
	Text RichTextClass
	// Date field of TextDate.
	Date int
}

// TextDateTypeID is TL type id of TextDate.
const TextDateTypeID = 0xa5b45e2b

// construct implements constructor of RichTextClass.
func ( TextDate) () RichTextClass { return & }

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

	_ RichTextClass = &TextDate{}
)

func ( *TextDate) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Relative == false) {
		return false
	}
	if !(.ShortTime == false) {
		return false
	}
	if !(.LongTime == false) {
		return false
	}
	if !(.ShortDate == false) {
		return false
	}
	if !(.LongDate == false) {
		return false
	}
	if !(.DayOfWeek == false) {
		return false
	}
	if !(.Text == nil) {
		return false
	}
	if !(.Date == 0) {
		return false
	}

	return true
}

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

// FillFrom fills TextDate from given interface.
func ( *TextDate) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( RichTextClass)
	() ( int)
}) {
	.Relative = .()
	.ShortTime = .()
	.LongTime = .()
	.ShortDate = .()
	.LongDate = .()
	.DayOfWeek = .()
	.Text = .()
	.Date = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *TextDate) () tdp.Type {
	 := tdp.Type{
		Name: "textDate",
		ID:   TextDateTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Relative",
			SchemaName: "relative",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "ShortTime",
			SchemaName: "short_time",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "LongTime",
			SchemaName: "long_time",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "ShortDate",
			SchemaName: "short_date",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "LongDate",
			SchemaName: "long_date",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "DayOfWeek",
			SchemaName: "day_of_week",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Text",
			SchemaName: "text",
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *TextDate) () {
	if !(.Relative == false) {
		.Flags.Set(0)
	}
	if !(.ShortTime == false) {
		.Flags.Set(1)
	}
	if !(.LongTime == false) {
		.Flags.Set(2)
	}
	if !(.ShortDate == false) {
		.Flags.Set(3)
	}
	if !(.LongDate == false) {
		.Flags.Set(4)
	}
	if !(.DayOfWeek == false) {
		.Flags.Set(5)
	}
}

// Encode implements bin.Encoder.
func ( *TextDate) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textDate#a5b45e2b as nil")
	}
	.PutID(TextDateTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *TextDate) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode textDate#a5b45e2b as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode textDate#a5b45e2b: field flags: %w", )
	}
	if .Text == nil {
		return fmt.Errorf("unable to encode textDate#a5b45e2b: field text is nil")
	}
	if  := .Text.Encode();  != nil {
		return fmt.Errorf("unable to encode textDate#a5b45e2b: field text: %w", )
	}
	.PutInt(.Date)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *TextDate) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode textDate#a5b45e2b to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode textDate#a5b45e2b: field flags: %w", )
		}
	}
	.Relative = .Flags.Has(0)
	.ShortTime = .Flags.Has(1)
	.LongTime = .Flags.Has(2)
	.ShortDate = .Flags.Has(3)
	.LongDate = .Flags.Has(4)
	.DayOfWeek = .Flags.Has(5)
	{
		,  := DecodeRichText()
		if  != nil {
			return fmt.Errorf("unable to decode textDate#a5b45e2b: field text: %w", )
		}
		.Text = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode textDate#a5b45e2b: field date: %w", )
		}
		.Date = 
	}
	return nil
}

// SetRelative sets value of Relative conditional field.
func ( *TextDate) ( bool) {
	if  {
		.Flags.Set(0)
		.Relative = true
	} else {
		.Flags.Unset(0)
		.Relative = false
	}
}

// GetRelative returns value of Relative conditional field.
func ( *TextDate) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetShortTime sets value of ShortTime conditional field.
func ( *TextDate) ( bool) {
	if  {
		.Flags.Set(1)
		.ShortTime = true
	} else {
		.Flags.Unset(1)
		.ShortTime = false
	}
}

// GetShortTime returns value of ShortTime conditional field.
func ( *TextDate) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetLongTime sets value of LongTime conditional field.
func ( *TextDate) ( bool) {
	if  {
		.Flags.Set(2)
		.LongTime = true
	} else {
		.Flags.Unset(2)
		.LongTime = false
	}
}

// GetLongTime returns value of LongTime conditional field.
func ( *TextDate) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// SetShortDate sets value of ShortDate conditional field.
func ( *TextDate) ( bool) {
	if  {
		.Flags.Set(3)
		.ShortDate = true
	} else {
		.Flags.Unset(3)
		.ShortDate = false
	}
}

// GetShortDate returns value of ShortDate conditional field.
func ( *TextDate) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetLongDate sets value of LongDate conditional field.
func ( *TextDate) ( bool) {
	if  {
		.Flags.Set(4)
		.LongDate = true
	} else {
		.Flags.Unset(4)
		.LongDate = false
	}
}

// GetLongDate returns value of LongDate conditional field.
func ( *TextDate) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(4)
}

// SetDayOfWeek sets value of DayOfWeek conditional field.
func ( *TextDate) ( bool) {
	if  {
		.Flags.Set(5)
		.DayOfWeek = true
	} else {
		.Flags.Unset(5)
		.DayOfWeek = false
	}
}

// GetDayOfWeek returns value of DayOfWeek conditional field.
func ( *TextDate) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// GetText returns value of Text field.
func ( *TextDate) () ( RichTextClass) {
	if  == nil {
		return
	}
	return .Text
}

// GetDate returns value of Date field.
func ( *TextDate) () ( int) {
	if  == nil {
		return
	}
	return .Date
}

// RichTextClassName is schema name of RichTextClass.
const RichTextClassName = "RichText"

// RichTextClass represents RichText generic type.
//
// See https://core.telegram.org/type/RichText for reference.
//
// Constructors:
//   - [TextEmpty]
//   - [TextPlain]
//   - [TextBold]
//   - [TextItalic]
//   - [TextUnderline]
//   - [TextStrike]
//   - [TextFixed]
//   - [TextURL]
//   - [TextEmail]
//   - [TextConcat]
//   - [TextSubscript]
//   - [TextSuperscript]
//   - [TextMarked]
//   - [TextPhone]
//   - [TextImage]
//   - [TextAnchor]
//   - [TextMath]
//   - [TextCustomEmoji]
//   - [TextSpoiler]
//   - [TextMention]
//   - [TextHashtag]
//   - [TextBotCommand]
//   - [TextCashtag]
//   - [TextAutoURL]
//   - [TextAutoEmail]
//   - [TextAutoPhone]
//   - [TextBankCard]
//   - [TextMentionName]
//   - [TextDate]
//
// Example:
//
//	g, err := tg.DecodeRichText(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.TextEmpty: // textEmpty#dc3d824f
//	case *tg.TextPlain: // textPlain#744694e0
//	case *tg.TextBold: // textBold#6724abc4
//	case *tg.TextItalic: // textItalic#d912a59c
//	case *tg.TextUnderline: // textUnderline#c12622c4
//	case *tg.TextStrike: // textStrike#9bf8bb95
//	case *tg.TextFixed: // textFixed#6c3f19b9
//	case *tg.TextURL: // textUrl#3c2884c1
//	case *tg.TextEmail: // textEmail#de5a0dd6
//	case *tg.TextConcat: // textConcat#7e6260d7
//	case *tg.TextSubscript: // textSubscript#ed6a8504
//	case *tg.TextSuperscript: // textSuperscript#c7fb5e01
//	case *tg.TextMarked: // textMarked#34b8621
//	case *tg.TextPhone: // textPhone#1ccb966a
//	case *tg.TextImage: // textImage#81ccf4f
//	case *tg.TextAnchor: // textAnchor#35553762
//	case *tg.TextMath: // textMath#9d2eac97
//	case *tg.TextCustomEmoji: // textCustomEmoji#a26156c0
//	case *tg.TextSpoiler: // textSpoiler#4c2a5d62
//	case *tg.TextMention: // textMention#cd24cf44
//	case *tg.TextHashtag: // textHashtag#519524ea
//	case *tg.TextBotCommand: // textBotCommand#2ff29d3
//	case *tg.TextCashtag: // textCashtag#7b9e1801
//	case *tg.TextAutoURL: // textAutoUrl#ac6a83aa
//	case *tg.TextAutoEmail: // textAutoEmail#c556a45d
//	case *tg.TextAutoPhone: // textAutoPhone#24c26789
//	case *tg.TextBankCard: // textBankCard#b956812d
//	case *tg.TextMentionName: // textMentionName#1a9fbfc
//	case *tg.TextDate: // textDate#a5b45e2b
//	default: panic(v)
//	}
type RichTextClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() RichTextClass

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

// DecodeRichText implements binary de-serialization for RichTextClass.
func ( *bin.Buffer) (RichTextClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case TextEmptyTypeID:
		// Decoding textEmpty#dc3d824f.
		 := TextEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextPlainTypeID:
		// Decoding textPlain#744694e0.
		 := TextPlain{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextBoldTypeID:
		// Decoding textBold#6724abc4.
		 := TextBold{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextItalicTypeID:
		// Decoding textItalic#d912a59c.
		 := TextItalic{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextUnderlineTypeID:
		// Decoding textUnderline#c12622c4.
		 := TextUnderline{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextStrikeTypeID:
		// Decoding textStrike#9bf8bb95.
		 := TextStrike{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextFixedTypeID:
		// Decoding textFixed#6c3f19b9.
		 := TextFixed{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextURLTypeID:
		// Decoding textUrl#3c2884c1.
		 := TextURL{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextEmailTypeID:
		// Decoding textEmail#de5a0dd6.
		 := TextEmail{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextConcatTypeID:
		// Decoding textConcat#7e6260d7.
		 := TextConcat{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextSubscriptTypeID:
		// Decoding textSubscript#ed6a8504.
		 := TextSubscript{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextSuperscriptTypeID:
		// Decoding textSuperscript#c7fb5e01.
		 := TextSuperscript{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextMarkedTypeID:
		// Decoding textMarked#34b8621.
		 := TextMarked{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextPhoneTypeID:
		// Decoding textPhone#1ccb966a.
		 := TextPhone{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextImageTypeID:
		// Decoding textImage#81ccf4f.
		 := TextImage{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextAnchorTypeID:
		// Decoding textAnchor#35553762.
		 := TextAnchor{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextMathTypeID:
		// Decoding textMath#9d2eac97.
		 := TextMath{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextCustomEmojiTypeID:
		// Decoding textCustomEmoji#a26156c0.
		 := TextCustomEmoji{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextSpoilerTypeID:
		// Decoding textSpoiler#4c2a5d62.
		 := TextSpoiler{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextMentionTypeID:
		// Decoding textMention#cd24cf44.
		 := TextMention{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextHashtagTypeID:
		// Decoding textHashtag#519524ea.
		 := TextHashtag{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextBotCommandTypeID:
		// Decoding textBotCommand#2ff29d3.
		 := TextBotCommand{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextCashtagTypeID:
		// Decoding textCashtag#7b9e1801.
		 := TextCashtag{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextAutoURLTypeID:
		// Decoding textAutoUrl#ac6a83aa.
		 := TextAutoURL{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextAutoEmailTypeID:
		// Decoding textAutoEmail#c556a45d.
		 := TextAutoEmail{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextAutoPhoneTypeID:
		// Decoding textAutoPhone#24c26789.
		 := TextAutoPhone{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextBankCardTypeID:
		// Decoding textBankCard#b956812d.
		 := TextBankCard{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextMentionNameTypeID:
		// Decoding textMentionName#1a9fbfc.
		 := TextMentionName{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	case TextDateTypeID:
		// Decoding textDate#a5b45e2b.
		 := TextDate{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode RichTextClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode RichTextClass: %w", bin.NewUnexpectedID())
	}
}

// RichText boxes the RichTextClass providing a helper.
type RichTextBox struct {
	RichText RichTextClass
}

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

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