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

// AccountSendVerifyPhoneCodeRequest represents TL type `account.sendVerifyPhoneCode#a5a356f9`.
// Send the verification phone code for telegram passport¹.
//
// Links:
//  1. https://core.telegram.org/passport
//
// See https://core.telegram.org/method/account.sendVerifyPhoneCode for reference.
type AccountSendVerifyPhoneCodeRequest struct {
	// The phone number to verify
	PhoneNumber string
	// Phone code settings
	Settings CodeSettings
}

// AccountSendVerifyPhoneCodeRequestTypeID is TL type id of AccountSendVerifyPhoneCodeRequest.
const AccountSendVerifyPhoneCodeRequestTypeID = 0xa5a356f9

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

func ( *AccountSendVerifyPhoneCodeRequest) () bool {
	if  == nil {
		return true
	}
	if !(.PhoneNumber == "") {
		return false
	}
	if !(.Settings.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills AccountSendVerifyPhoneCodeRequest from given interface.
func ( *AccountSendVerifyPhoneCodeRequest) ( interface {
	() ( string)
	() ( CodeSettings)
}) {
	.PhoneNumber = .()
	.Settings = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountSendVerifyPhoneCodeRequest) () string {
	return "account.sendVerifyPhoneCode"
}

// TypeInfo returns info about TL type.
func ( *AccountSendVerifyPhoneCodeRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.sendVerifyPhoneCode",
		ID:   AccountSendVerifyPhoneCodeRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "Settings",
			SchemaName: "settings",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountSendVerifyPhoneCodeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.sendVerifyPhoneCode#a5a356f9 as nil")
	}
	.PutID(AccountSendVerifyPhoneCodeRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountSendVerifyPhoneCodeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.sendVerifyPhoneCode#a5a356f9 as nil")
	}
	.PutString(.PhoneNumber)
	if  := .Settings.Encode();  != nil {
		return fmt.Errorf("unable to encode account.sendVerifyPhoneCode#a5a356f9: field settings: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountSendVerifyPhoneCodeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.sendVerifyPhoneCode#a5a356f9 to nil")
	}
	if  := .ConsumeID(AccountSendVerifyPhoneCodeRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.sendVerifyPhoneCode#a5a356f9: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountSendVerifyPhoneCodeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.sendVerifyPhoneCode#a5a356f9 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode account.sendVerifyPhoneCode#a5a356f9: field phone_number: %w", )
		}
		.PhoneNumber = 
	}
	{
		if  := .Settings.Decode();  != nil {
			return fmt.Errorf("unable to decode account.sendVerifyPhoneCode#a5a356f9: field settings: %w", )
		}
	}
	return nil
}

// GetPhoneNumber returns value of PhoneNumber field.
func ( *AccountSendVerifyPhoneCodeRequest) () ( string) {
	if  == nil {
		return
	}
	return .PhoneNumber
}

// GetSettings returns value of Settings field.
func ( *AccountSendVerifyPhoneCodeRequest) () ( CodeSettings) {
	if  == nil {
		return
	}
	return .Settings
}

// AccountSendVerifyPhoneCode invokes method account.sendVerifyPhoneCode#a5a356f9 returning error if any.
// Send the verification phone code for telegram passport¹.
//
// Links:
//  1. https://core.telegram.org/passport
//
// Possible errors:
//
//	400 PHONE_NUMBER_INVALID: The phone number is invalid.
//
// See https://core.telegram.org/method/account.sendVerifyPhoneCode for reference.
func ( *Client) ( context.Context,  *AccountSendVerifyPhoneCodeRequest) (AuthSentCodeClass, error) {
	var  AuthSentCodeBox

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