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

// AccountVerifyPhoneRequest represents TL type `account.verifyPhone#4dd3a7f6`.
// Verify a phone number for telegram passport¹.
//
// Links:
//  1. https://core.telegram.org/passport
//
// See https://core.telegram.org/method/account.verifyPhone for reference.
type AccountVerifyPhoneRequest struct {
	// Phone number
	PhoneNumber string
	// Phone code hash received from the call to account.sendVerifyPhoneCode¹
	//
	// Links:
	//  1) https://core.telegram.org/method/account.sendVerifyPhoneCode
	PhoneCodeHash string
	// Code received after the call to account.sendVerifyPhoneCode¹
	//
	// Links:
	//  1) https://core.telegram.org/method/account.sendVerifyPhoneCode
	PhoneCode string
}

// AccountVerifyPhoneRequestTypeID is TL type id of AccountVerifyPhoneRequest.
const AccountVerifyPhoneRequestTypeID = 0x4dd3a7f6

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

func ( *AccountVerifyPhoneRequest) () bool {
	if  == nil {
		return true
	}
	if !(.PhoneNumber == "") {
		return false
	}
	if !(.PhoneCodeHash == "") {
		return false
	}
	if !(.PhoneCode == "") {
		return false
	}

	return true
}

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

// FillFrom fills AccountVerifyPhoneRequest from given interface.
func ( *AccountVerifyPhoneRequest) ( interface {
	() ( string)
	() ( string)
	() ( string)
}) {
	.PhoneNumber = .()
	.PhoneCodeHash = .()
	.PhoneCode = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountVerifyPhoneRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.verifyPhone",
		ID:   AccountVerifyPhoneRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "PhoneCodeHash",
			SchemaName: "phone_code_hash",
		},
		{
			Name:       "PhoneCode",
			SchemaName: "phone_code",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountVerifyPhoneRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.verifyPhone#4dd3a7f6 as nil")
	}
	.PutID(AccountVerifyPhoneRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountVerifyPhoneRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.verifyPhone#4dd3a7f6 as nil")
	}
	.PutString(.PhoneNumber)
	.PutString(.PhoneCodeHash)
	.PutString(.PhoneCode)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountVerifyPhoneRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.verifyPhone#4dd3a7f6 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode account.verifyPhone#4dd3a7f6: field phone_number: %w", )
		}
		.PhoneNumber = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode account.verifyPhone#4dd3a7f6: field phone_code_hash: %w", )
		}
		.PhoneCodeHash = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode account.verifyPhone#4dd3a7f6: field phone_code: %w", )
		}
		.PhoneCode = 
	}
	return nil
}

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

// GetPhoneCodeHash returns value of PhoneCodeHash field.
func ( *AccountVerifyPhoneRequest) () ( string) {
	if  == nil {
		return
	}
	return .PhoneCodeHash
}

// GetPhoneCode returns value of PhoneCode field.
func ( *AccountVerifyPhoneRequest) () ( string) {
	if  == nil {
		return
	}
	return .PhoneCode
}

// AccountVerifyPhone invokes method account.verifyPhone#4dd3a7f6 returning error if any.
// Verify a phone number for telegram passport¹.
//
// Links:
//  1. https://core.telegram.org/passport
//
// Possible errors:
//
//	400 PHONE_CODE_EMPTY: phone_code is missing.
//	400 PHONE_CODE_EXPIRED: The phone code you provided has expired.
//	400 PHONE_NUMBER_INVALID: The phone number is invalid.
//
// See https://core.telegram.org/method/account.verifyPhone for reference.
func ( *Client) ( context.Context,  *AccountVerifyPhoneRequest) (bool, error) {
	var  BoolBox

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