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

// MessagesSetInlineGameScoreRequest represents TL type `messages.setInlineGameScore#15ad9f64`.
// Use this method to set the score of the specified user in a game sent as an inline
// message (bots only).
//
// See https://core.telegram.org/method/messages.setInlineGameScore for reference.
type MessagesSetInlineGameScoreRequest struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Set this flag if the game message should be automatically edited to include the
	// current scoreboard
	EditMessage bool
	// Set this flag if the high score is allowed to decrease. This can be useful when fixing
	// mistakes or banning cheaters
	Force bool
	// ID of the inline message
	ID InputBotInlineMessageIDClass
	// User identifier
	UserID InputUserClass
	// New score
	Score int
}

// MessagesSetInlineGameScoreRequestTypeID is TL type id of MessagesSetInlineGameScoreRequest.
const MessagesSetInlineGameScoreRequestTypeID = 0x15ad9f64

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

func ( *MessagesSetInlineGameScoreRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.EditMessage == false) {
		return false
	}
	if !(.Force == false) {
		return false
	}
	if !(.ID == nil) {
		return false
	}
	if !(.UserID == nil) {
		return false
	}
	if !(.Score == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesSetInlineGameScoreRequest from given interface.
func ( *MessagesSetInlineGameScoreRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( InputBotInlineMessageIDClass)
	() ( InputUserClass)
	() ( int)
}) {
	.EditMessage = .()
	.Force = .()
	.ID = .()
	.UserID = .()
	.Score = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesSetInlineGameScoreRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.setInlineGameScore",
		ID:   MessagesSetInlineGameScoreRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "EditMessage",
			SchemaName: "edit_message",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Force",
			SchemaName: "force",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Score",
			SchemaName: "score",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesSetInlineGameScoreRequest) () {
	if !(.EditMessage == false) {
		.Flags.Set(0)
	}
	if !(.Force == false) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesSetInlineGameScoreRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.setInlineGameScore#15ad9f64 as nil")
	}
	.PutID(MessagesSetInlineGameScoreRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesSetInlineGameScoreRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.setInlineGameScore#15ad9f64 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.setInlineGameScore#15ad9f64: field flags: %w", )
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode messages.setInlineGameScore#15ad9f64: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.setInlineGameScore#15ad9f64: field id: %w", )
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode messages.setInlineGameScore#15ad9f64: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.setInlineGameScore#15ad9f64: field user_id: %w", )
	}
	.PutInt(.Score)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesSetInlineGameScoreRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.setInlineGameScore#15ad9f64 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.setInlineGameScore#15ad9f64: field flags: %w", )
		}
	}
	.EditMessage = .Flags.Has(0)
	.Force = .Flags.Has(1)
	{
		,  := DecodeInputBotInlineMessageID()
		if  != nil {
			return fmt.Errorf("unable to decode messages.setInlineGameScore#15ad9f64: field id: %w", )
		}
		.ID = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode messages.setInlineGameScore#15ad9f64: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.setInlineGameScore#15ad9f64: field score: %w", )
		}
		.Score = 
	}
	return nil
}

// SetEditMessage sets value of EditMessage conditional field.
func ( *MessagesSetInlineGameScoreRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.EditMessage = true
	} else {
		.Flags.Unset(0)
		.EditMessage = false
	}
}

// GetEditMessage returns value of EditMessage conditional field.
func ( *MessagesSetInlineGameScoreRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetForce sets value of Force conditional field.
func ( *MessagesSetInlineGameScoreRequest) ( bool) {
	if  {
		.Flags.Set(1)
		.Force = true
	} else {
		.Flags.Unset(1)
		.Force = false
	}
}

// GetForce returns value of Force conditional field.
func ( *MessagesSetInlineGameScoreRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

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

// GetUserID returns value of UserID field.
func ( *MessagesSetInlineGameScoreRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

// GetScore returns value of Score field.
func ( *MessagesSetInlineGameScoreRequest) () ( int) {
	if  == nil {
		return
	}
	return .Score
}

// MessagesSetInlineGameScore invokes method messages.setInlineGameScore#15ad9f64 returning error if any.
// Use this method to set the score of the specified user in a game sent as an inline
// message (bots only).
//
// Possible errors:
//
//	400 MESSAGE_ID_INVALID: The provided message id is invalid.
//	400 USER_BOT_REQUIRED: This method can only be called by a bot.
//
// See https://core.telegram.org/method/messages.setInlineGameScore for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *MessagesSetInlineGameScoreRequest) (bool, error) {
	var  BoolBox

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