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

// MessagesEditInlineBotMessageRequest represents TL type `messages.editInlineBotMessage#83557dba`.
// Edit an inline bot message
//
// See https://core.telegram.org/method/messages.editInlineBotMessage for reference.
type MessagesEditInlineBotMessageRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Disable webpage preview
	NoWebpage bool
	// If set, any eventual webpage preview will be shown on top of the message instead of at
	// the bottom.
	InvertMedia bool
	// Sent inline message ID
	ID InputBotInlineMessageIDClass
	// Message
	//
	// Use SetMessage and GetMessage helpers.
	Message string
	// Media
	//
	// Use SetMedia and GetMedia helpers.
	Media InputMediaClass
	// Reply markup for inline keyboards
	//
	// Use SetReplyMarkup and GetReplyMarkup helpers.
	ReplyMarkup ReplyMarkupClass
	// Message entities for styled text¹
	//
	// Links:
	//  1) https://core.telegram.org/api/entities
	//
	// Use SetEntities and GetEntities helpers.
	Entities []MessageEntityClass
}

// MessagesEditInlineBotMessageRequestTypeID is TL type id of MessagesEditInlineBotMessageRequest.
const MessagesEditInlineBotMessageRequestTypeID = 0x83557dba

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

func ( *MessagesEditInlineBotMessageRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.NoWebpage == false) {
		return false
	}
	if !(.InvertMedia == false) {
		return false
	}
	if !(.ID == nil) {
		return false
	}
	if !(.Message == "") {
		return false
	}
	if !(.Media == nil) {
		return false
	}
	if !(.ReplyMarkup == nil) {
		return false
	}
	if !(.Entities == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesEditInlineBotMessageRequest from given interface.
func ( *MessagesEditInlineBotMessageRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( InputBotInlineMessageIDClass)
	() ( string,  bool)
	() ( InputMediaClass,  bool)
	() ( ReplyMarkupClass,  bool)
	() ( []MessageEntityClass,  bool)
}) {
	.NoWebpage = .()
	.InvertMedia = .()
	.ID = .()
	if ,  := .();  {
		.Message = 
	}

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

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesEditInlineBotMessageRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.editInlineBotMessage",
		ID:   MessagesEditInlineBotMessageRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "NoWebpage",
			SchemaName: "no_webpage",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "InvertMedia",
			SchemaName: "invert_media",
			Null:       !.Flags.Has(16),
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Message",
			SchemaName: "message",
			Null:       !.Flags.Has(11),
		},
		{
			Name:       "Media",
			SchemaName: "media",
			Null:       !.Flags.Has(14),
		},
		{
			Name:       "ReplyMarkup",
			SchemaName: "reply_markup",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Entities",
			SchemaName: "entities",
			Null:       !.Flags.Has(3),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesEditInlineBotMessageRequest) () {
	if !(.NoWebpage == false) {
		.Flags.Set(1)
	}
	if !(.InvertMedia == false) {
		.Flags.Set(16)
	}
	if !(.Message == "") {
		.Flags.Set(11)
	}
	if !(.Media == nil) {
		.Flags.Set(14)
	}
	if !(.ReplyMarkup == nil) {
		.Flags.Set(2)
	}
	if !(.Entities == nil) {
		.Flags.Set(3)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesEditInlineBotMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editInlineBotMessage#83557dba as nil")
	}
	.PutID(MessagesEditInlineBotMessageRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesEditInlineBotMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editInlineBotMessage#83557dba as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field flags: %w", )
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field id: %w", )
	}
	if .Flags.Has(11) {
		.PutString(.Message)
	}
	if .Flags.Has(14) {
		if .Media == nil {
			return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field media is nil")
		}
		if  := .Media.Encode();  != nil {
			return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field media: %w", )
		}
	}
	if .Flags.Has(2) {
		if .ReplyMarkup == nil {
			return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field reply_markup is nil")
		}
		if  := .ReplyMarkup.Encode();  != nil {
			return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field reply_markup: %w", )
		}
	}
	if .Flags.Has(3) {
		.PutVectorHeader(len(.Entities))
		for ,  := range .Entities {
			if  == nil {
				return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field entities element with index %d is nil", )
			}
			if  := .Encode();  != nil {
				return fmt.Errorf("unable to encode messages.editInlineBotMessage#83557dba: field entities element with index %d: %w", , )
			}
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesEditInlineBotMessageRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.editInlineBotMessage#83557dba to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.editInlineBotMessage#83557dba: field flags: %w", )
		}
	}
	.NoWebpage = .Flags.Has(1)
	.InvertMedia = .Flags.Has(16)
	{
		,  := DecodeInputBotInlineMessageID()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editInlineBotMessage#83557dba: field id: %w", )
		}
		.ID = 
	}
	if .Flags.Has(11) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editInlineBotMessage#83557dba: field message: %w", )
		}
		.Message = 
	}
	if .Flags.Has(14) {
		,  := DecodeInputMedia()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editInlineBotMessage#83557dba: field media: %w", )
		}
		.Media = 
	}
	if .Flags.Has(2) {
		,  := DecodeReplyMarkup()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editInlineBotMessage#83557dba: field reply_markup: %w", )
		}
		.ReplyMarkup = 
	}
	if .Flags.Has(3) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editInlineBotMessage#83557dba: field entities: %w", )
		}

		if  > 0 {
			.Entities = make([]MessageEntityClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeMessageEntity()
			if  != nil {
				return fmt.Errorf("unable to decode messages.editInlineBotMessage#83557dba: field entities: %w", )
			}
			.Entities = append(.Entities, )
		}
	}
	return nil
}

// SetNoWebpage sets value of NoWebpage conditional field.
func ( *MessagesEditInlineBotMessageRequest) ( bool) {
	if  {
		.Flags.Set(1)
		.NoWebpage = true
	} else {
		.Flags.Unset(1)
		.NoWebpage = false
	}
}

// GetNoWebpage returns value of NoWebpage conditional field.
func ( *MessagesEditInlineBotMessageRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetInvertMedia sets value of InvertMedia conditional field.
func ( *MessagesEditInlineBotMessageRequest) ( bool) {
	if  {
		.Flags.Set(16)
		.InvertMedia = true
	} else {
		.Flags.Unset(16)
		.InvertMedia = false
	}
}

// GetInvertMedia returns value of InvertMedia conditional field.
func ( *MessagesEditInlineBotMessageRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(16)
}

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

// SetMessage sets value of Message conditional field.
func ( *MessagesEditInlineBotMessageRequest) ( string) {
	.Flags.Set(11)
	.Message = 
}

// GetMessage returns value of Message conditional field and
// boolean which is true if field was set.
func ( *MessagesEditInlineBotMessageRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(11) {
		return , false
	}
	return .Message, true
}

// SetMedia sets value of Media conditional field.
func ( *MessagesEditInlineBotMessageRequest) ( InputMediaClass) {
	.Flags.Set(14)
	.Media = 
}

// GetMedia returns value of Media conditional field and
// boolean which is true if field was set.
func ( *MessagesEditInlineBotMessageRequest) () ( InputMediaClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(14) {
		return , false
	}
	return .Media, true
}

// SetReplyMarkup sets value of ReplyMarkup conditional field.
func ( *MessagesEditInlineBotMessageRequest) ( ReplyMarkupClass) {
	.Flags.Set(2)
	.ReplyMarkup = 
}

// GetReplyMarkup returns value of ReplyMarkup conditional field and
// boolean which is true if field was set.
func ( *MessagesEditInlineBotMessageRequest) () ( ReplyMarkupClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .ReplyMarkup, true
}

// SetEntities sets value of Entities conditional field.
func ( *MessagesEditInlineBotMessageRequest) ( []MessageEntityClass) {
	.Flags.Set(3)
	.Entities = 
}

// GetEntities returns value of Entities conditional field and
// boolean which is true if field was set.
func ( *MessagesEditInlineBotMessageRequest) () ( []MessageEntityClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .Entities, true
}

// MapEntities returns field Entities wrapped in MessageEntityClassArray helper.
func ( *MessagesEditInlineBotMessageRequest) () ( MessageEntityClassArray,  bool) {
	if !.Flags.Has(3) {
		return , false
	}
	return MessageEntityClassArray(.Entities), true
}

// MessagesEditInlineBotMessage invokes method messages.editInlineBotMessage#83557dba returning error if any.
// Edit an inline bot message
//
// Possible errors:
//
//	400 BUTTON_DATA_INVALID: The data of one or more of the buttons you provided is invalid.
//	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 MESSAGE_ID_INVALID: The provided message id is invalid.
//	400 MESSAGE_NOT_MODIFIED: The provided message data is identical to the previous message data, the message wasn't modified.
//
// See https://core.telegram.org/method/messages.editInlineBotMessage for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *MessagesEditInlineBotMessageRequest) (bool, error) {
	var  BoolBox

	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}