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

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

// RichTextClass represents RichText generic type.
//
// See https://core.telegram.org/type/RichText for reference.
//
// 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
//	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
	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()
}