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

// BotInlineResult represents TL type `botInlineResult#11965f3a`.
// Generic result
//
// See https://core.telegram.org/constructor/botInlineResult for reference.
type BotInlineResult struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Result ID
	ID string
	// Result type (see bot API docs¹)
	//
	// Links:
	//  1) https://core.telegram.org/bots/api#inlinequeryresult
	Type string
	// Result title
	//
	// Use SetTitle and GetTitle helpers.
	Title string
	// Result description
	//
	// Use SetDescription and GetDescription helpers.
	Description string
	// URL of article or webpage
	//
	// Use SetURL and GetURL helpers.
	URL string
	// Thumbnail for the result
	//
	// Use SetThumb and GetThumb helpers.
	Thumb WebDocumentClass
	// Content of the result
	//
	// Use SetContent and GetContent helpers.
	Content WebDocumentClass
	// Message to send
	SendMessage BotInlineMessageClass
}

// BotInlineResultTypeID is TL type id of BotInlineResult.
const BotInlineResultTypeID = 0x11965f3a

// construct implements constructor of BotInlineResultClass.
func ( BotInlineResult) () BotInlineResultClass { return & }

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

	_ BotInlineResultClass = &BotInlineResult{}
)

func ( *BotInlineResult) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ID == "") {
		return false
	}
	if !(.Type == "") {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.Description == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.Thumb == nil) {
		return false
	}
	if !(.Content == nil) {
		return false
	}
	if !(.SendMessage == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotInlineResult from given interface.
func ( *BotInlineResult) ( interface {
	() ( string)
	() ( string)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( WebDocumentClass,  bool)
	() ( WebDocumentClass,  bool)
	() ( BotInlineMessageClass)
}) {
	.ID = .()
	.Type = .()
	if ,  := .();  {
		.Title = 
	}

	if ,  := .();  {
		.Description = 
	}

	if ,  := .();  {
		.URL = 
	}

	if ,  := .();  {
		.Thumb = 
	}

	if ,  := .();  {
		.Content = 
	}

	.SendMessage = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BotInlineResult) () tdp.Type {
	 := tdp.Type{
		Name: "botInlineResult",
		ID:   BotInlineResultTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "Title",
			SchemaName: "title",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Description",
			SchemaName: "description",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "URL",
			SchemaName: "url",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "Thumb",
			SchemaName: "thumb",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "Content",
			SchemaName: "content",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "SendMessage",
			SchemaName: "send_message",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotInlineResult) () {
	if !(.Title == "") {
		.Flags.Set(1)
	}
	if !(.Description == "") {
		.Flags.Set(2)
	}
	if !(.URL == "") {
		.Flags.Set(3)
	}
	if !(.Thumb == nil) {
		.Flags.Set(4)
	}
	if !(.Content == nil) {
		.Flags.Set(5)
	}
}

// Encode implements bin.Encoder.
func ( *BotInlineResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineResult#11965f3a as nil")
	}
	.PutID(BotInlineResultTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotInlineResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineResult#11965f3a as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineResult#11965f3a: field flags: %w", )
	}
	.PutString(.ID)
	.PutString(.Type)
	if .Flags.Has(1) {
		.PutString(.Title)
	}
	if .Flags.Has(2) {
		.PutString(.Description)
	}
	if .Flags.Has(3) {
		.PutString(.URL)
	}
	if .Flags.Has(4) {
		if .Thumb == nil {
			return fmt.Errorf("unable to encode botInlineResult#11965f3a: field thumb is nil")
		}
		if  := .Thumb.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineResult#11965f3a: field thumb: %w", )
		}
	}
	if .Flags.Has(5) {
		if .Content == nil {
			return fmt.Errorf("unable to encode botInlineResult#11965f3a: field content is nil")
		}
		if  := .Content.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineResult#11965f3a: field content: %w", )
		}
	}
	if .SendMessage == nil {
		return fmt.Errorf("unable to encode botInlineResult#11965f3a: field send_message is nil")
	}
	if  := .SendMessage.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineResult#11965f3a: field send_message: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotInlineResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botInlineResult#11965f3a to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field type: %w", )
		}
		.Type = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field title: %w", )
		}
		.Title = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field description: %w", )
		}
		.Description = 
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field url: %w", )
		}
		.URL = 
	}
	if .Flags.Has(4) {
		,  := DecodeWebDocument()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field thumb: %w", )
		}
		.Thumb = 
	}
	if .Flags.Has(5) {
		,  := DecodeWebDocument()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field content: %w", )
		}
		.Content = 
	}
	{
		,  := DecodeBotInlineMessage()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineResult#11965f3a: field send_message: %w", )
		}
		.SendMessage = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *BotInlineResult) () ( string) {
	if  == nil {
		return
	}
	return .ID
}

// GetType returns value of Type field.
func ( *BotInlineResult) () ( string) {
	if  == nil {
		return
	}
	return .Type
}

// SetTitle sets value of Title conditional field.
func ( *BotInlineResult) ( string) {
	.Flags.Set(1)
	.Title = 
}

// GetTitle returns value of Title conditional field and
// boolean which is true if field was set.
func ( *BotInlineResult) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .Title, true
}

// SetDescription sets value of Description conditional field.
func ( *BotInlineResult) ( string) {
	.Flags.Set(2)
	.Description = 
}

// GetDescription returns value of Description conditional field and
// boolean which is true if field was set.
func ( *BotInlineResult) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Description, true
}

// SetURL sets value of URL conditional field.
func ( *BotInlineResult) ( string) {
	.Flags.Set(3)
	.URL = 
}

// GetURL returns value of URL conditional field and
// boolean which is true if field was set.
func ( *BotInlineResult) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .URL, true
}

// SetThumb sets value of Thumb conditional field.
func ( *BotInlineResult) ( WebDocumentClass) {
	.Flags.Set(4)
	.Thumb = 
}

// GetThumb returns value of Thumb conditional field and
// boolean which is true if field was set.
func ( *BotInlineResult) () ( WebDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .Thumb, true
}

// SetContent sets value of Content conditional field.
func ( *BotInlineResult) ( WebDocumentClass) {
	.Flags.Set(5)
	.Content = 
}

// GetContent returns value of Content conditional field and
// boolean which is true if field was set.
func ( *BotInlineResult) () ( WebDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(5) {
		return , false
	}
	return .Content, true
}

// GetSendMessage returns value of SendMessage field.
func ( *BotInlineResult) () ( BotInlineMessageClass) {
	if  == nil {
		return
	}
	return .SendMessage
}

// BotInlineMediaResult represents TL type `botInlineMediaResult#17db940b`.
// Media result
//
// See https://core.telegram.org/constructor/botInlineMediaResult for reference.
type BotInlineMediaResult struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Result ID
	ID string
	// Result type (see bot API docs¹)
	//
	// Links:
	//  1) https://core.telegram.org/bots/api#inlinequeryresult
	Type string
	// If type is photo, the photo to send
	//
	// Use SetPhoto and GetPhoto helpers.
	Photo PhotoClass
	// If type is document, the document to send
	//
	// Use SetDocument and GetDocument helpers.
	Document DocumentClass
	// Result title
	//
	// Use SetTitle and GetTitle helpers.
	Title string
	// Description
	//
	// Use SetDescription and GetDescription helpers.
	Description string
	// Depending on the type and on the constructor¹, contains the caption of the media or
	// the content of the message to be sent instead of the media
	//
	// Links:
	//  1) https://core.telegram.org/type/BotInlineMessage
	SendMessage BotInlineMessageClass
}

// BotInlineMediaResultTypeID is TL type id of BotInlineMediaResult.
const BotInlineMediaResultTypeID = 0x17db940b

// construct implements constructor of BotInlineResultClass.
func ( BotInlineMediaResult) () BotInlineResultClass { return & }

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

	_ BotInlineResultClass = &BotInlineMediaResult{}
)

func ( *BotInlineMediaResult) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.ID == "") {
		return false
	}
	if !(.Type == "") {
		return false
	}
	if !(.Photo == nil) {
		return false
	}
	if !(.Document == nil) {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.Description == "") {
		return false
	}
	if !(.SendMessage == nil) {
		return false
	}

	return true
}

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

// FillFrom fills BotInlineMediaResult from given interface.
func ( *BotInlineMediaResult) ( interface {
	() ( string)
	() ( string)
	() ( PhotoClass,  bool)
	() ( DocumentClass,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( BotInlineMessageClass)
}) {
	.ID = .()
	.Type = .()
	if ,  := .();  {
		.Photo = 
	}

	if ,  := .();  {
		.Document = 
	}

	if ,  := .();  {
		.Title = 
	}

	if ,  := .();  {
		.Description = 
	}

	.SendMessage = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BotInlineMediaResult) () tdp.Type {
	 := tdp.Type{
		Name: "botInlineMediaResult",
		ID:   BotInlineMediaResultTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "Photo",
			SchemaName: "photo",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Document",
			SchemaName: "document",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Title",
			SchemaName: "title",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Description",
			SchemaName: "description",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "SendMessage",
			SchemaName: "send_message",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotInlineMediaResult) () {
	if !(.Photo == nil) {
		.Flags.Set(0)
	}
	if !(.Document == nil) {
		.Flags.Set(1)
	}
	if !(.Title == "") {
		.Flags.Set(2)
	}
	if !(.Description == "") {
		.Flags.Set(3)
	}
}

// Encode implements bin.Encoder.
func ( *BotInlineMediaResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMediaResult#17db940b as nil")
	}
	.PutID(BotInlineMediaResultTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotInlineMediaResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botInlineMediaResult#17db940b as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMediaResult#17db940b: field flags: %w", )
	}
	.PutString(.ID)
	.PutString(.Type)
	if .Flags.Has(0) {
		if .Photo == nil {
			return fmt.Errorf("unable to encode botInlineMediaResult#17db940b: field photo is nil")
		}
		if  := .Photo.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMediaResult#17db940b: field photo: %w", )
		}
	}
	if .Flags.Has(1) {
		if .Document == nil {
			return fmt.Errorf("unable to encode botInlineMediaResult#17db940b: field document is nil")
		}
		if  := .Document.Encode();  != nil {
			return fmt.Errorf("unable to encode botInlineMediaResult#17db940b: field document: %w", )
		}
	}
	if .Flags.Has(2) {
		.PutString(.Title)
	}
	if .Flags.Has(3) {
		.PutString(.Description)
	}
	if .SendMessage == nil {
		return fmt.Errorf("unable to encode botInlineMediaResult#17db940b: field send_message is nil")
	}
	if  := .SendMessage.Encode();  != nil {
		return fmt.Errorf("unable to encode botInlineMediaResult#17db940b: field send_message: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotInlineMediaResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botInlineMediaResult#17db940b to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botInlineMediaResult#17db940b: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMediaResult#17db940b: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMediaResult#17db940b: field type: %w", )
		}
		.Type = 
	}
	if .Flags.Has(0) {
		,  := DecodePhoto()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMediaResult#17db940b: field photo: %w", )
		}
		.Photo = 
	}
	if .Flags.Has(1) {
		,  := DecodeDocument()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMediaResult#17db940b: field document: %w", )
		}
		.Document = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMediaResult#17db940b: field title: %w", )
		}
		.Title = 
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMediaResult#17db940b: field description: %w", )
		}
		.Description = 
	}
	{
		,  := DecodeBotInlineMessage()
		if  != nil {
			return fmt.Errorf("unable to decode botInlineMediaResult#17db940b: field send_message: %w", )
		}
		.SendMessage = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *BotInlineMediaResult) () ( string) {
	if  == nil {
		return
	}
	return .ID
}

// GetType returns value of Type field.
func ( *BotInlineMediaResult) () ( string) {
	if  == nil {
		return
	}
	return .Type
}

// SetPhoto sets value of Photo conditional field.
func ( *BotInlineMediaResult) ( PhotoClass) {
	.Flags.Set(0)
	.Photo = 
}

// GetPhoto returns value of Photo conditional field and
// boolean which is true if field was set.
func ( *BotInlineMediaResult) () ( PhotoClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Photo, true
}

// SetDocument sets value of Document conditional field.
func ( *BotInlineMediaResult) ( DocumentClass) {
	.Flags.Set(1)
	.Document = 
}

// GetDocument returns value of Document conditional field and
// boolean which is true if field was set.
func ( *BotInlineMediaResult) () ( DocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .Document, true
}

// SetTitle sets value of Title conditional field.
func ( *BotInlineMediaResult) ( string) {
	.Flags.Set(2)
	.Title = 
}

// GetTitle returns value of Title conditional field and
// boolean which is true if field was set.
func ( *BotInlineMediaResult) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Title, true
}

// SetDescription sets value of Description conditional field.
func ( *BotInlineMediaResult) ( string) {
	.Flags.Set(3)
	.Description = 
}

// GetDescription returns value of Description conditional field and
// boolean which is true if field was set.
func ( *BotInlineMediaResult) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .Description, true
}

// GetSendMessage returns value of SendMessage field.
func ( *BotInlineMediaResult) () ( BotInlineMessageClass) {
	if  == nil {
		return
	}
	return .SendMessage
}

// BotInlineResultClassName is schema name of BotInlineResultClass.
const BotInlineResultClassName = "BotInlineResult"

// BotInlineResultClass represents BotInlineResult generic type.
//
// See https://core.telegram.org/type/BotInlineResult for reference.
//
// Example:
//
//	g, err := tg.DecodeBotInlineResult(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.BotInlineResult: // botInlineResult#11965f3a
//	case *tg.BotInlineMediaResult: // botInlineMediaResult#17db940b
//	default: panic(v)
//	}
type BotInlineResultClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() BotInlineResultClass

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

	// Result ID
	GetID() (value string)

	// Result type (see bot API docs¹)
	//
	// Links:
	//  1) https://core.telegram.org/bots/api#inlinequeryresult
	GetType() (value string)

	// Result title
	GetTitle() (value string, ok bool)

	// Result description
	GetDescription() (value string, ok bool)

	// Message to send
	GetSendMessage() (value BotInlineMessageClass)
}

// DecodeBotInlineResult implements binary de-serialization for BotInlineResultClass.
func ( *bin.Buffer) (BotInlineResultClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case BotInlineResultTypeID:
		// Decoding botInlineResult#11965f3a.
		 := BotInlineResult{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineResultClass: %w", )
		}
		return &, nil
	case BotInlineMediaResultTypeID:
		// Decoding botInlineMediaResult#17db940b.
		 := BotInlineMediaResult{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode BotInlineResultClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode BotInlineResultClass: %w", bin.NewUnexpectedID())
	}
}

// BotInlineResult boxes the BotInlineResultClass providing a helper.
type BotInlineResultBox struct {
	BotInlineResult BotInlineResultClass
}

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

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