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

// BotsSetBotInfoRequest represents TL type `bots.setBotInfo#10cf3123`.
// Set 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.setBotInfo for reference.
type BotsSetBotInfoRequest 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 update the fallback about text and description
	LangCode string
	// New bot name
	//
	// Use SetName and GetName helpers.
	Name string
	// New about text
	//
	// Use SetAbout and GetAbout helpers.
	About string
	// New description
	//
	// Use SetDescription and GetDescription helpers.
	Description string
}

// BotsSetBotInfoRequestTypeID is TL type id of BotsSetBotInfoRequest.
const BotsSetBotInfoRequestTypeID = 0x10cf3123

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

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

	return true
}

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

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

	.LangCode = .()
	if ,  := .();  {
		.Name = 
	}

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *BotsSetBotInfoRequest) () tdp.Type {
	 := tdp.Type{
		Name: "bots.setBotInfo",
		ID:   BotsSetBotInfoRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Bot",
			SchemaName: "bot",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "LangCode",
			SchemaName: "lang_code",
		},
		{
			Name:       "Name",
			SchemaName: "name",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "About",
			SchemaName: "about",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Description",
			SchemaName: "description",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotsSetBotInfoRequest) () {
	if !(.Bot == nil) {
		.Flags.Set(2)
	}
	if !(.Name == "") {
		.Flags.Set(3)
	}
	if !(.About == "") {
		.Flags.Set(0)
	}
	if !(.Description == "") {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *BotsSetBotInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.setBotInfo#10cf3123 as nil")
	}
	.PutID(BotsSetBotInfoRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotsSetBotInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode bots.setBotInfo#10cf3123 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode bots.setBotInfo#10cf3123: field flags: %w", )
	}
	if .Flags.Has(2) {
		if .Bot == nil {
			return fmt.Errorf("unable to encode bots.setBotInfo#10cf3123: field bot is nil")
		}
		if  := .Bot.Encode();  != nil {
			return fmt.Errorf("unable to encode bots.setBotInfo#10cf3123: field bot: %w", )
		}
	}
	.PutString(.LangCode)
	if .Flags.Has(3) {
		.PutString(.Name)
	}
	if .Flags.Has(0) {
		.PutString(.About)
	}
	if .Flags.Has(1) {
		.PutString(.Description)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotsSetBotInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode bots.setBotInfo#10cf3123 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode bots.setBotInfo#10cf3123: field flags: %w", )
		}
	}
	if .Flags.Has(2) {
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode bots.setBotInfo#10cf3123: field bot: %w", )
		}
		.Bot = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bots.setBotInfo#10cf3123: field lang_code: %w", )
		}
		.LangCode = 
	}
	if .Flags.Has(3) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bots.setBotInfo#10cf3123: field name: %w", )
		}
		.Name = 
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bots.setBotInfo#10cf3123: field about: %w", )
		}
		.About = 
	}
	if .Flags.Has(1) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode bots.setBotInfo#10cf3123: field description: %w", )
		}
		.Description = 
	}
	return nil
}

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

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

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

// SetName sets value of Name conditional field.
func ( *BotsSetBotInfoRequest) ( string) {
	.Flags.Set(3)
	.Name = 
}

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

// SetAbout sets value of About conditional field.
func ( *BotsSetBotInfoRequest) ( string) {
	.Flags.Set(0)
	.About = 
}

// GetAbout returns value of About conditional field and
// boolean which is true if field was set.
func ( *BotsSetBotInfoRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .About, true
}

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

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

// BotsSetBotInfo invokes method bots.setBotInfo#10cf3123 returning error if any.
// Set localized name, about text and description of a bot (or of the current account, if
// called by a bot).
//
// Possible errors:
//
//	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.setBotInfo for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *BotsSetBotInfoRequest) (bool, error) {
	var  BoolBox

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