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

// InputBotInlineResult represents TL type `inputBotInlineResult#88bf9319`.
// An inline bot result
//
// See https://core.telegram.org/constructor/inputBotInlineResult for reference.
type InputBotInlineResult struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// ID of result
	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 result
	//
	// Use SetURL and GetURL helpers.
	URL string
	// Thumbnail for result
	//
	// Use SetThumb and GetThumb helpers.
	Thumb InputWebDocument
	// Result contents
	//
	// Use SetContent and GetContent helpers.
	Content InputWebDocument
	// Message to send when the result is selected
	SendMessage InputBotInlineMessageClass
}

// InputBotInlineResultTypeID is TL type id of InputBotInlineResult.
const InputBotInlineResultTypeID = 0x88bf9319

// construct implements constructor of InputBotInlineResultClass.
func ( InputBotInlineResult) () InputBotInlineResultClass { return & }

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

	_ InputBotInlineResultClass = &InputBotInlineResult{}
)

func ( *InputBotInlineResult) () 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.Zero()) {
		return false
	}
	if !(.Content.Zero()) {
		return false
	}
	if !(.SendMessage == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputBotInlineResult from given interface.
func ( *InputBotInlineResult) ( interface {
	() ( string)
	() ( string)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( InputWebDocument,  bool)
	() ( InputWebDocument,  bool)
	() ( InputBotInlineMessageClass)
}) {
	.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 (*InputBotInlineResult) () uint32 {
	return InputBotInlineResultTypeID
}

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

// TypeInfo returns info about TL type.
func ( *InputBotInlineResult) () tdp.Type {
	 := tdp.Type{
		Name: "inputBotInlineResult",
		ID:   InputBotInlineResultTypeID,
	}
	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 ( *InputBotInlineResult) () {
	if !(.Title == "") {
		.Flags.Set(1)
	}
	if !(.Description == "") {
		.Flags.Set(2)
	}
	if !(.URL == "") {
		.Flags.Set(3)
	}
	if !(.Thumb.Zero()) {
		.Flags.Set(4)
	}
	if !(.Content.Zero()) {
		.Flags.Set(5)
	}
}

// Encode implements bin.Encoder.
func ( *InputBotInlineResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBotInlineResult#88bf9319 as nil")
	}
	.PutID(InputBotInlineResultTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputBotInlineResult) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBotInlineResult#88bf9319 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputBotInlineResult#88bf9319: 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.Encode();  != nil {
			return fmt.Errorf("unable to encode inputBotInlineResult#88bf9319: field thumb: %w", )
		}
	}
	if .Flags.Has(5) {
		if  := .Content.Encode();  != nil {
			return fmt.Errorf("unable to encode inputBotInlineResult#88bf9319: field content: %w", )
		}
	}
	if .SendMessage == nil {
		return fmt.Errorf("unable to encode inputBotInlineResult#88bf9319: field send_message is nil")
	}
	if  := .SendMessage.Encode();  != nil {
		return fmt.Errorf("unable to encode inputBotInlineResult#88bf9319: field send_message: %w", )
	}
	return nil
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// InputBotInlineResultPhoto represents TL type `inputBotInlineResultPhoto#a8d864a7`.
// Photo
//
// See https://core.telegram.org/constructor/inputBotInlineResultPhoto for reference.
type InputBotInlineResultPhoto struct {
	// Result ID
	ID string
	// Result type (see bot API docsĀ¹)
	//
	// Links:
	//  1) https://core.telegram.org/bots/api#inlinequeryresult
	Type string
	// Photo to send
	Photo InputPhotoClass
	// Message to send when the result is selected
	SendMessage InputBotInlineMessageClass
}

// InputBotInlineResultPhotoTypeID is TL type id of InputBotInlineResultPhoto.
const InputBotInlineResultPhotoTypeID = 0xa8d864a7

// construct implements constructor of InputBotInlineResultClass.
func ( InputBotInlineResultPhoto) () InputBotInlineResultClass { return & }

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

	_ InputBotInlineResultClass = &InputBotInlineResultPhoto{}
)

func ( *InputBotInlineResultPhoto) () bool {
	if  == nil {
		return true
	}
	if !(.ID == "") {
		return false
	}
	if !(.Type == "") {
		return false
	}
	if !(.Photo == nil) {
		return false
	}
	if !(.SendMessage == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputBotInlineResultPhoto from given interface.
func ( *InputBotInlineResultPhoto) ( interface {
	() ( string)
	() ( string)
	() ( InputPhotoClass)
	() ( InputBotInlineMessageClass)
}) {
	.ID = .()
	.Type = .()
	.Photo = .()
	.SendMessage = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputBotInlineResultPhoto) () tdp.Type {
	 := tdp.Type{
		Name: "inputBotInlineResultPhoto",
		ID:   InputBotInlineResultPhotoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "Photo",
			SchemaName: "photo",
		},
		{
			Name:       "SendMessage",
			SchemaName: "send_message",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputBotInlineResultPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBotInlineResultPhoto#a8d864a7 as nil")
	}
	.PutID(InputBotInlineResultPhotoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputBotInlineResultPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBotInlineResultPhoto#a8d864a7 as nil")
	}
	.PutString(.ID)
	.PutString(.Type)
	if .Photo == nil {
		return fmt.Errorf("unable to encode inputBotInlineResultPhoto#a8d864a7: field photo is nil")
	}
	if  := .Photo.Encode();  != nil {
		return fmt.Errorf("unable to encode inputBotInlineResultPhoto#a8d864a7: field photo: %w", )
	}
	if .SendMessage == nil {
		return fmt.Errorf("unable to encode inputBotInlineResultPhoto#a8d864a7: field send_message is nil")
	}
	if  := .SendMessage.Encode();  != nil {
		return fmt.Errorf("unable to encode inputBotInlineResultPhoto#a8d864a7: field send_message: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputBotInlineResultPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputBotInlineResultPhoto#a8d864a7 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultPhoto#a8d864a7: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultPhoto#a8d864a7: field type: %w", )
		}
		.Type = 
	}
	{
		,  := DecodeInputPhoto()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultPhoto#a8d864a7: field photo: %w", )
		}
		.Photo = 
	}
	{
		,  := DecodeInputBotInlineMessage()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultPhoto#a8d864a7: field send_message: %w", )
		}
		.SendMessage = 
	}
	return nil
}

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

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

// GetPhoto returns value of Photo field.
func ( *InputBotInlineResultPhoto) () ( InputPhotoClass) {
	if  == nil {
		return
	}
	return .Photo
}

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

// InputBotInlineResultDocument represents TL type `inputBotInlineResultDocument#fff8fdc4`.
// Document (media of any type except for photos)
//
// See https://core.telegram.org/constructor/inputBotInlineResultDocument for reference.
type InputBotInlineResultDocument 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
	// Document to send
	Document InputDocumentClass
	// Message to send when the result is selected
	SendMessage InputBotInlineMessageClass
}

// InputBotInlineResultDocumentTypeID is TL type id of InputBotInlineResultDocument.
const InputBotInlineResultDocumentTypeID = 0xfff8fdc4

// construct implements constructor of InputBotInlineResultClass.
func ( InputBotInlineResultDocument) () InputBotInlineResultClass { return & }

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

	_ InputBotInlineResultClass = &InputBotInlineResultDocument{}
)

func ( *InputBotInlineResultDocument) () 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 !(.Document == nil) {
		return false
	}
	if !(.SendMessage == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputBotInlineResultDocument from given interface.
func ( *InputBotInlineResultDocument) ( interface {
	() ( string)
	() ( string)
	() ( string,  bool)
	() ( string,  bool)
	() ( InputDocumentClass)
	() ( InputBotInlineMessageClass)
}) {
	.ID = .()
	.Type = .()
	if ,  := .();  {
		.Title = 
	}

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

	.Document = .()
	.SendMessage = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputBotInlineResultDocument) () tdp.Type {
	 := tdp.Type{
		Name: "inputBotInlineResultDocument",
		ID:   InputBotInlineResultDocumentTypeID,
	}
	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:       "Document",
			SchemaName: "document",
		},
		{
			Name:       "SendMessage",
			SchemaName: "send_message",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *InputBotInlineResultDocument) () {
	if !(.Title == "") {
		.Flags.Set(1)
	}
	if !(.Description == "") {
		.Flags.Set(2)
	}
}

// Encode implements bin.Encoder.
func ( *InputBotInlineResultDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBotInlineResultDocument#fff8fdc4 as nil")
	}
	.PutID(InputBotInlineResultDocumentTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *InputBotInlineResultDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputBotInlineResultDocument#fff8fdc4 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultDocument#fff8fdc4: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultDocument#fff8fdc4: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultDocument#fff8fdc4: field type: %w", )
		}
		.Type = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultDocument#fff8fdc4: field title: %w", )
		}
		.Title = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultDocument#fff8fdc4: field description: %w", )
		}
		.Description = 
	}
	{
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultDocument#fff8fdc4: field document: %w", )
		}
		.Document = 
	}
	{
		,  := DecodeInputBotInlineMessage()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultDocument#fff8fdc4: field send_message: %w", )
		}
		.SendMessage = 
	}
	return nil
}

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

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

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

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

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

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

// GetDocument returns value of Document field.
func ( *InputBotInlineResultDocument) () ( InputDocumentClass) {
	if  == nil {
		return
	}
	return .Document
}

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

// InputBotInlineResultGame represents TL type `inputBotInlineResultGame#4fa417f2`.
// Game
//
// See https://core.telegram.org/constructor/inputBotInlineResultGame for reference.
type InputBotInlineResultGame struct {
	// Result ID
	ID string
	// Game short name
	ShortName string
	// Message to send when the result is selected
	SendMessage InputBotInlineMessageClass
}

// InputBotInlineResultGameTypeID is TL type id of InputBotInlineResultGame.
const InputBotInlineResultGameTypeID = 0x4fa417f2

// construct implements constructor of InputBotInlineResultClass.
func ( InputBotInlineResultGame) () InputBotInlineResultClass { return & }

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

	_ InputBotInlineResultClass = &InputBotInlineResultGame{}
)

func ( *InputBotInlineResultGame) () bool {
	if  == nil {
		return true
	}
	if !(.ID == "") {
		return false
	}
	if !(.ShortName == "") {
		return false
	}
	if !(.SendMessage == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputBotInlineResultGame from given interface.
func ( *InputBotInlineResultGame) ( interface {
	() ( string)
	() ( string)
	() ( InputBotInlineMessageClass)
}) {
	.ID = .()
	.ShortName = .()
	.SendMessage = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputBotInlineResultGame) () tdp.Type {
	 := tdp.Type{
		Name: "inputBotInlineResultGame",
		ID:   InputBotInlineResultGameTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "ShortName",
			SchemaName: "short_name",
		},
		{
			Name:       "SendMessage",
			SchemaName: "send_message",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputBotInlineResultGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBotInlineResultGame#4fa417f2 as nil")
	}
	.PutID(InputBotInlineResultGameTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputBotInlineResultGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBotInlineResultGame#4fa417f2 as nil")
	}
	.PutString(.ID)
	.PutString(.ShortName)
	if .SendMessage == nil {
		return fmt.Errorf("unable to encode inputBotInlineResultGame#4fa417f2: field send_message is nil")
	}
	if  := .SendMessage.Encode();  != nil {
		return fmt.Errorf("unable to encode inputBotInlineResultGame#4fa417f2: field send_message: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputBotInlineResultGame) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputBotInlineResultGame#4fa417f2 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultGame#4fa417f2: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultGame#4fa417f2: field short_name: %w", )
		}
		.ShortName = 
	}
	{
		,  := DecodeInputBotInlineMessage()
		if  != nil {
			return fmt.Errorf("unable to decode inputBotInlineResultGame#4fa417f2: field send_message: %w", )
		}
		.SendMessage = 
	}
	return nil
}

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

// GetShortName returns value of ShortName field.
func ( *InputBotInlineResultGame) () ( string) {
	if  == nil {
		return
	}
	return .ShortName
}

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

// InputBotInlineResultClassName is schema name of InputBotInlineResultClass.
const InputBotInlineResultClassName = "InputBotInlineResult"

// InputBotInlineResultClass represents InputBotInlineResult generic type.
//
// See https://core.telegram.org/type/InputBotInlineResult for reference.
//
// Example:
//
//	g, err := tg.DecodeInputBotInlineResult(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputBotInlineResult: // inputBotInlineResult#88bf9319
//	case *tg.InputBotInlineResultPhoto: // inputBotInlineResultPhoto#a8d864a7
//	case *tg.InputBotInlineResultDocument: // inputBotInlineResultDocument#fff8fdc4
//	case *tg.InputBotInlineResultGame: // inputBotInlineResultGame#4fa417f2
//	default: panic(v)
//	}
type InputBotInlineResultClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputBotInlineResultClass

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

	// ID of result
	GetID() (value string)

	// Message to send when the result is selected
	GetSendMessage() (value InputBotInlineMessageClass)
}

// DecodeInputBotInlineResult implements binary de-serialization for InputBotInlineResultClass.
func ( *bin.Buffer) (InputBotInlineResultClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputBotInlineResultTypeID:
		// Decoding inputBotInlineResult#88bf9319.
		 := InputBotInlineResult{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputBotInlineResultClass: %w", )
		}
		return &, nil
	case InputBotInlineResultPhotoTypeID:
		// Decoding inputBotInlineResultPhoto#a8d864a7.
		 := InputBotInlineResultPhoto{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputBotInlineResultClass: %w", )
		}
		return &, nil
	case InputBotInlineResultDocumentTypeID:
		// Decoding inputBotInlineResultDocument#fff8fdc4.
		 := InputBotInlineResultDocument{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputBotInlineResultClass: %w", )
		}
		return &, nil
	case InputBotInlineResultGameTypeID:
		// Decoding inputBotInlineResultGame#4fa417f2.
		 := InputBotInlineResultGame{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputBotInlineResultClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputBotInlineResultClass: %w", bin.NewUnexpectedID())
	}
}

// InputBotInlineResult boxes the InputBotInlineResultClass providing a helper.
type InputBotInlineResultBox struct {
	InputBotInlineResult InputBotInlineResultClass
}

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

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