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

// MessagesSendInlineBotResultRequest represents TL type `messages.sendInlineBotResult#f7bc68ba`.
// Send a result obtained using messages.getInlineBotResults¹.
//
// Links:
//  1. https://core.telegram.org/method/messages.getInlineBotResults
//
// See https://core.telegram.org/method/messages.sendInlineBotResult for reference.
type MessagesSendInlineBotResultRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to send the message silently (no notification will be triggered on the other
	// client)
	Silent bool
	// Whether to send the message in background
	Background bool
	// Whether to clear the draft¹
	//
	// Links:
	//  1) https://core.telegram.org/api/drafts
	ClearDraft bool
	// Whether to hide the via @botname in the resulting message (only for bot usernames
	// encountered in the config¹)
	//
	// Links:
	//  1) https://core.telegram.org/constructor/config
	HideVia bool
	// Destination
	Peer InputPeerClass
	// If set, indicates that the message should be sent in reply to the specified message or
	// story.
	//
	// Use SetReplyTo and GetReplyTo helpers.
	ReplyTo InputReplyToClass
	// Random ID to avoid resending the same query
	RandomID int64
	// Query ID from messages.getInlineBotResults¹
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.getInlineBotResults
	QueryID int64
	// Result ID from messages.getInlineBotResults¹
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.getInlineBotResults
	ID string
	// Scheduled message date for scheduled messages
	//
	// Use SetScheduleDate and GetScheduleDate helpers.
	ScheduleDate int
	// Send this message as the specified peer
	//
	// Use SetSendAs and GetSendAs helpers.
	SendAs InputPeerClass
}

// MessagesSendInlineBotResultRequestTypeID is TL type id of MessagesSendInlineBotResultRequest.
const MessagesSendInlineBotResultRequestTypeID = 0xf7bc68ba

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

func ( *MessagesSendInlineBotResultRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Silent == false) {
		return false
	}
	if !(.Background == false) {
		return false
	}
	if !(.ClearDraft == false) {
		return false
	}
	if !(.HideVia == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.ReplyTo == nil) {
		return false
	}
	if !(.RandomID == 0) {
		return false
	}
	if !(.QueryID == 0) {
		return false
	}
	if !(.ID == "") {
		return false
	}
	if !(.ScheduleDate == 0) {
		return false
	}
	if !(.SendAs == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesSendInlineBotResultRequest from given interface.
func ( *MessagesSendInlineBotResultRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( InputPeerClass)
	() ( InputReplyToClass,  bool)
	() ( int64)
	() ( int64)
	() ( string)
	() ( int,  bool)
	() ( InputPeerClass,  bool)
}) {
	.Silent = .()
	.Background = .()
	.ClearDraft = .()
	.HideVia = .()
	.Peer = .()
	if ,  := .();  {
		.ReplyTo = 
	}

	.RandomID = .()
	.QueryID = .()
	.ID = .()
	if ,  := .();  {
		.ScheduleDate = 
	}

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

}

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

// TypeName returns name of type in TL schema.
func (*MessagesSendInlineBotResultRequest) () string {
	return "messages.sendInlineBotResult"
}

// TypeInfo returns info about TL type.
func ( *MessagesSendInlineBotResultRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.sendInlineBotResult",
		ID:   MessagesSendInlineBotResultRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Silent",
			SchemaName: "silent",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Background",
			SchemaName: "background",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "ClearDraft",
			SchemaName: "clear_draft",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "HideVia",
			SchemaName: "hide_via",
			Null:       !.Flags.Has(11),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "ReplyTo",
			SchemaName: "reply_to",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "RandomID",
			SchemaName: "random_id",
		},
		{
			Name:       "QueryID",
			SchemaName: "query_id",
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "ScheduleDate",
			SchemaName: "schedule_date",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "SendAs",
			SchemaName: "send_as",
			Null:       !.Flags.Has(13),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesSendInlineBotResultRequest) () {
	if !(.Silent == false) {
		.Flags.Set(5)
	}
	if !(.Background == false) {
		.Flags.Set(6)
	}
	if !(.ClearDraft == false) {
		.Flags.Set(7)
	}
	if !(.HideVia == false) {
		.Flags.Set(11)
	}
	if !(.ReplyTo == nil) {
		.Flags.Set(0)
	}
	if !(.ScheduleDate == 0) {
		.Flags.Set(10)
	}
	if !(.SendAs == nil) {
		.Flags.Set(13)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesSendInlineBotResultRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.sendInlineBotResult#f7bc68ba as nil")
	}
	.PutID(MessagesSendInlineBotResultRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesSendInlineBotResultRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.sendInlineBotResult#f7bc68ba as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field peer: %w", )
	}
	if .Flags.Has(0) {
		if .ReplyTo == nil {
			return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field reply_to is nil")
		}
		if  := .ReplyTo.Encode();  != nil {
			return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field reply_to: %w", )
		}
	}
	.PutLong(.RandomID)
	.PutLong(.QueryID)
	.PutString(.ID)
	if .Flags.Has(10) {
		.PutInt(.ScheduleDate)
	}
	if .Flags.Has(13) {
		if .SendAs == nil {
			return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field send_as is nil")
		}
		if  := .SendAs.Encode();  != nil {
			return fmt.Errorf("unable to encode messages.sendInlineBotResult#f7bc68ba: field send_as: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesSendInlineBotResultRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.sendInlineBotResult#f7bc68ba to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field flags: %w", )
		}
	}
	.Silent = .Flags.Has(5)
	.Background = .Flags.Has(6)
	.ClearDraft = .Flags.Has(7)
	.HideVia = .Flags.Has(11)
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field peer: %w", )
		}
		.Peer = 
	}
	if .Flags.Has(0) {
		,  := DecodeInputReplyTo()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field reply_to: %w", )
		}
		.ReplyTo = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field random_id: %w", )
		}
		.RandomID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field query_id: %w", )
		}
		.QueryID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(10) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field schedule_date: %w", )
		}
		.ScheduleDate = 
	}
	if .Flags.Has(13) {
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.sendInlineBotResult#f7bc68ba: field send_as: %w", )
		}
		.SendAs = 
	}
	return nil
}

// SetSilent sets value of Silent conditional field.
func ( *MessagesSendInlineBotResultRequest) ( bool) {
	if  {
		.Flags.Set(5)
		.Silent = true
	} else {
		.Flags.Unset(5)
		.Silent = false
	}
}

// GetSilent returns value of Silent conditional field.
func ( *MessagesSendInlineBotResultRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// SetBackground sets value of Background conditional field.
func ( *MessagesSendInlineBotResultRequest) ( bool) {
	if  {
		.Flags.Set(6)
		.Background = true
	} else {
		.Flags.Unset(6)
		.Background = false
	}
}

// GetBackground returns value of Background conditional field.
func ( *MessagesSendInlineBotResultRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(6)
}

// SetClearDraft sets value of ClearDraft conditional field.
func ( *MessagesSendInlineBotResultRequest) ( bool) {
	if  {
		.Flags.Set(7)
		.ClearDraft = true
	} else {
		.Flags.Unset(7)
		.ClearDraft = false
	}
}

// GetClearDraft returns value of ClearDraft conditional field.
func ( *MessagesSendInlineBotResultRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(7)
}

// SetHideVia sets value of HideVia conditional field.
func ( *MessagesSendInlineBotResultRequest) ( bool) {
	if  {
		.Flags.Set(11)
		.HideVia = true
	} else {
		.Flags.Unset(11)
		.HideVia = false
	}
}

// GetHideVia returns value of HideVia conditional field.
func ( *MessagesSendInlineBotResultRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(11)
}

// GetPeer returns value of Peer field.
func ( *MessagesSendInlineBotResultRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// SetReplyTo sets value of ReplyTo conditional field.
func ( *MessagesSendInlineBotResultRequest) ( InputReplyToClass) {
	.Flags.Set(0)
	.ReplyTo = 
}

// GetReplyTo returns value of ReplyTo conditional field and
// boolean which is true if field was set.
func ( *MessagesSendInlineBotResultRequest) () ( InputReplyToClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .ReplyTo, true
}

// GetRandomID returns value of RandomID field.
func ( *MessagesSendInlineBotResultRequest) () ( int64) {
	if  == nil {
		return
	}
	return .RandomID
}

// GetQueryID returns value of QueryID field.
func ( *MessagesSendInlineBotResultRequest) () ( int64) {
	if  == nil {
		return
	}
	return .QueryID
}

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

// SetScheduleDate sets value of ScheduleDate conditional field.
func ( *MessagesSendInlineBotResultRequest) ( int) {
	.Flags.Set(10)
	.ScheduleDate = 
}

// GetScheduleDate returns value of ScheduleDate conditional field and
// boolean which is true if field was set.
func ( *MessagesSendInlineBotResultRequest) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(10) {
		return , false
	}
	return .ScheduleDate, true
}

// SetSendAs sets value of SendAs conditional field.
func ( *MessagesSendInlineBotResultRequest) ( InputPeerClass) {
	.Flags.Set(13)
	.SendAs = 
}

// GetSendAs returns value of SendAs conditional field and
// boolean which is true if field was set.
func ( *MessagesSendInlineBotResultRequest) () ( InputPeerClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(13) {
		return , false
	}
	return .SendAs, true
}

// MessagesSendInlineBotResult invokes method messages.sendInlineBotResult#f7bc68ba returning error if any.
// Send a result obtained using messages.getInlineBotResults¹.
//
// Links:
//  1. https://core.telegram.org/method/messages.getInlineBotResults
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	403 CHAT_GUEST_SEND_FORBIDDEN: You join the discussion group before commenting, see here » for more info.
//	400 CHAT_RESTRICTED: You can't send messages in this chat, you were restricted.
//	403 CHAT_SEND_AUDIOS_FORBIDDEN: You can't send audio messages in this chat.
//	403 CHAT_SEND_GAME_FORBIDDEN: You can't send a game to this chat.
//	403 CHAT_SEND_GIFS_FORBIDDEN: You can't send gifs in this chat.
//	403 CHAT_SEND_INLINE_FORBIDDEN: You can't send inline messages in this group.
//	403 CHAT_SEND_MEDIA_FORBIDDEN: You can't send media in this chat.
//	403 CHAT_SEND_PHOTOS_FORBIDDEN: You can't send photos in this chat.
//	403 CHAT_SEND_STICKERS_FORBIDDEN: You can't send stickers in this chat.
//	403 CHAT_SEND_VOICES_FORBIDDEN: You can't send voice recordings in this chat.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 ENTITY_BOUNDS_INVALID: A specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length.
//	400 INLINE_RESULT_EXPIRED: The inline query expired.
//	400 INPUT_USER_DEACTIVATED: The specified user was deleted.
//	400 MEDIA_EMPTY: The provided media object is invalid.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 QUERY_ID_EMPTY: The query ID is empty.
//	500 RANDOM_ID_DUPLICATE: You provided a random ID that was already used.
//	400 RESULT_ID_EMPTY: Result ID empty.
//	400 RESULT_ID_INVALID: One of the specified result IDs is invalid.
//	400 SCHEDULE_DATE_TOO_LATE: You can't schedule a message this far in the future.
//	400 SCHEDULE_TOO_MUCH: There are too many scheduled messages.
//	500 SEND_MEDIA_INVALID:
//	420 SLOWMODE_WAIT_%d: Slowmode is enabled in this chat: wait %d seconds before sending another message to this chat.
//	400 TOPIC_DELETED: The specified topic was deleted.
//	400 USER_BANNED_IN_CHANNEL: You're banned from sending messages in supergroups/channels.
//	400 VOICE_MESSAGES_FORBIDDEN: This user's privacy settings forbid you from sending voice messages.
//	400 WEBPAGE_CURL_FAILED: Failure while fetching the webpage with cURL.
//	400 WEBPAGE_MEDIA_EMPTY: Webpage media empty.
//	400 YOU_BLOCKED_USER: You blocked this user.
//
// See https://core.telegram.org/method/messages.sendInlineBotResult for reference.
func ( *Client) ( context.Context,  *MessagesSendInlineBotResultRequest) (UpdatesClass, error) {
	var  UpdatesBox

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .Updates, nil
}