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

// AuthCheckPaidAuthRequest represents TL type `auth.checkPaidAuth#56e59f9c`.
// Checks the status of a login payment¹.
//
// Links:
//  1. https://core.telegram.org/api/auth#paid-auth
//
// See https://core.telegram.org/method/auth.checkPaidAuth for reference.
type AuthCheckPaidAuthRequest struct {
	// Phone number
	PhoneNumber string
	// The phone code hash obtained from auth.sendCode¹
	//
	// Links:
	//  1) https://core.telegram.org/method/auth.sendCode
	PhoneCodeHash string
	// The payment form ID passed to payments.sendPaymentForm¹.
	//
	// Links:
	//  1) https://core.telegram.org/method/payments.sendPaymentForm
	FormID int64
}

// AuthCheckPaidAuthRequestTypeID is TL type id of AuthCheckPaidAuthRequest.
const AuthCheckPaidAuthRequestTypeID = 0x56e59f9c

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

func ( *AuthCheckPaidAuthRequest) () bool {
	if  == nil {
		return true
	}
	if !(.PhoneNumber == "") {
		return false
	}
	if !(.PhoneCodeHash == "") {
		return false
	}
	if !(.FormID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills AuthCheckPaidAuthRequest from given interface.
func ( *AuthCheckPaidAuthRequest) ( interface {
	() ( string)
	() ( string)
	() ( int64)
}) {
	.PhoneNumber = .()
	.PhoneCodeHash = .()
	.FormID = .()
}

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

// TypeName returns name of type in TL schema.
func (*AuthCheckPaidAuthRequest) () string {
	return "auth.checkPaidAuth"
}

// TypeInfo returns info about TL type.
func ( *AuthCheckPaidAuthRequest) () tdp.Type {
	 := tdp.Type{
		Name: "auth.checkPaidAuth",
		ID:   AuthCheckPaidAuthRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "PhoneCodeHash",
			SchemaName: "phone_code_hash",
		},
		{
			Name:       "FormID",
			SchemaName: "form_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AuthCheckPaidAuthRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.checkPaidAuth#56e59f9c as nil")
	}
	.PutID(AuthCheckPaidAuthRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AuthCheckPaidAuthRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.checkPaidAuth#56e59f9c as nil")
	}
	.PutString(.PhoneNumber)
	.PutString(.PhoneCodeHash)
	.PutLong(.FormID)
	return nil
}

// Decode implements bin.Decoder.
func ( *AuthCheckPaidAuthRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.checkPaidAuth#56e59f9c to nil")
	}
	if  := .ConsumeID(AuthCheckPaidAuthRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode auth.checkPaidAuth#56e59f9c: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AuthCheckPaidAuthRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.checkPaidAuth#56e59f9c to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode auth.checkPaidAuth#56e59f9c: field phone_number: %w", )
		}
		.PhoneNumber = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode auth.checkPaidAuth#56e59f9c: field phone_code_hash: %w", )
		}
		.PhoneCodeHash = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode auth.checkPaidAuth#56e59f9c: field form_id: %w", )
		}
		.FormID = 
	}
	return nil
}

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

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

// GetFormID returns value of FormID field.
func ( *AuthCheckPaidAuthRequest) () ( int64) {
	if  == nil {
		return
	}
	return .FormID
}

// AuthCheckPaidAuth invokes method auth.checkPaidAuth#56e59f9c returning error if any.
// Checks the status of a login payment¹.
//
// Links:
//  1. https://core.telegram.org/api/auth#paid-auth
//
// Possible errors:
//
//	400 PHONE_NUMBER_INVALID: The phone number is invalid.
//
// See https://core.telegram.org/method/auth.checkPaidAuth for reference.
func ( *Client) ( context.Context,  *AuthCheckPaidAuthRequest) (AuthSentCodeClass, error) {
	var  AuthSentCodeBox

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