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

// BotsGetBotInfoRequest represents TL type `bots.getBotInfo#dcd914fd`.
// Get localized name, about text and description of a bot (or of the current account, if
// called by a bot).
//
// See https://core.telegram.org/method/bots.getBotInfo for reference.
type BotsGetBotInfoRequest struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If called by a user, must contain the peer of a bot we own.
	//
	// Use SetBot and GetBot helpers.
	Bot InputUserClass
	// Language code, if left empty this method will return the fallback about text and
	// description.
	LangCode string
}

// BotsGetBotInfoRequestTypeID is TL type id of BotsGetBotInfoRequest.
const BotsGetBotInfoRequestTypeID = 0xdcd914fd

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

func ( *BotsGetBotInfoRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Bot == nil) {
		return false
	}
	if !(.LangCode == "") {
		return false
	}

	return true
}

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

// FillFrom fills BotsGetBotInfoRequest from given interface.
func ( *BotsGetBotInfoRequest) ( interface {
	() ( InputUserClass,  bool)
	() ( string)
}) {
	if ,  := .();  {
		.Bot = 
	}

	.LangCode = .()
}

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

// TypeName returns name of type in TL schema.
func (*BotsGetBotInfoRequest) () string {
	return "bots.getBotInfo"
}

// TypeInfo returns info about TL type.
func ( *BotsGetBotInfoRequest) () tdp.Type {
	 := tdp.Type{
		Name: "bots.getBotInfo",
		ID:   BotsGetBotInfoRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Bot",
			SchemaName: "bot",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "LangCode",
			SchemaName: "lang_code",
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotsGetBotInfoRequest) () {
	if !(.Bot == nil) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *BotsGetBotInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.getBotInfo#dcd914fd as nil")
	}
	.PutID(BotsGetBotInfoRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotsGetBotInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.getBotInfo#dcd914fd as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode bots.getBotInfo#dcd914fd: field flags: %w", )
	}
	if .Flags.Has(0) {
		if .Bot == nil {
			return fmt.Errorf("unable to encode bots.getBotInfo#dcd914fd: field bot is nil")
		}
		if  := .Bot.Encode();  != nil {
			return fmt.Errorf("unable to encode bots.getBotInfo#dcd914fd: field bot: %w", )
		}
	}
	.PutString(.LangCode)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotsGetBotInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.getBotInfo#dcd914fd to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode bots.getBotInfo#dcd914fd: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode bots.getBotInfo#dcd914fd: field bot: %w", )
		}
		.Bot = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bots.getBotInfo#dcd914fd: field lang_code: %w", )
		}
		.LangCode = 
	}
	return nil
}

// SetBot sets value of Bot conditional field.
func ( *BotsGetBotInfoRequest) ( InputUserClass) {
	.Flags.Set(0)
	.Bot = 
}

// GetBot returns value of Bot conditional field and
// boolean which is true if field was set.
func ( *BotsGetBotInfoRequest) () ( InputUserClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Bot, true
}

// GetLangCode returns value of LangCode field.
func ( *BotsGetBotInfoRequest) () ( string) {
	if  == nil {
		return
	}
	return .LangCode
}

// BotsGetBotInfo invokes method bots.getBotInfo#dcd914fd returning error if any.
// Get localized name, about text and description of a bot (or of the current account, if
// called by a bot).
//
// Possible errors:
//
//	400 LANG_CODE_INVALID: The specified language code is invalid.
//	400 USER_BOT_INVALID: User accounts must provide the bot method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts.
//
// See https://core.telegram.org/method/bots.getBotInfo for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *BotsGetBotInfoRequest) (*BotsBotInfo, error) {
	var  BotsBotInfo

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