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

// AuthCheckRecoveryPasswordRequest represents TL type `auth.checkRecoveryPassword#d36bf79`.
// Check if the 2FA recovery code¹ sent using auth.requestPasswordRecovery² is valid,
// before passing it to auth.recoverPassword³.
//
// Links:
//  1. https://core.telegram.org/api/srp
//  2. https://core.telegram.org/method/auth.requestPasswordRecovery
//  3. https://core.telegram.org/method/auth.recoverPassword
//
// See https://core.telegram.org/method/auth.checkRecoveryPassword for reference.
type AuthCheckRecoveryPasswordRequest struct {
	// Code received via email
	Code string
}

// AuthCheckRecoveryPasswordRequestTypeID is TL type id of AuthCheckRecoveryPasswordRequest.
const AuthCheckRecoveryPasswordRequestTypeID = 0xd36bf79

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

func ( *AuthCheckRecoveryPasswordRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Code == "") {
		return false
	}

	return true
}

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

// FillFrom fills AuthCheckRecoveryPasswordRequest from given interface.
func ( *AuthCheckRecoveryPasswordRequest) ( interface {
	() ( string)
}) {
	.Code = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AuthCheckRecoveryPasswordRequest) () tdp.Type {
	 := tdp.Type{
		Name: "auth.checkRecoveryPassword",
		ID:   AuthCheckRecoveryPasswordRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Code",
			SchemaName: "code",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AuthCheckRecoveryPasswordRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.checkRecoveryPassword#d36bf79 as nil")
	}
	.PutID(AuthCheckRecoveryPasswordRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AuthCheckRecoveryPasswordRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.checkRecoveryPassword#d36bf79 as nil")
	}
	.PutString(.Code)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AuthCheckRecoveryPasswordRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.checkRecoveryPassword#d36bf79 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode auth.checkRecoveryPassword#d36bf79: field code: %w", )
		}
		.Code = 
	}
	return nil
}

// GetCode returns value of Code field.
func ( *AuthCheckRecoveryPasswordRequest) () ( string) {
	if  == nil {
		return
	}
	return .Code
}

// AuthCheckRecoveryPassword invokes method auth.checkRecoveryPassword#d36bf79 returning error if any.
// Check if the 2FA recovery code¹ sent using auth.requestPasswordRecovery² is valid,
// before passing it to auth.recoverPassword³.
//
// Links:
//  1. https://core.telegram.org/api/srp
//  2. https://core.telegram.org/method/auth.requestPasswordRecovery
//  3. https://core.telegram.org/method/auth.recoverPassword
//
// Possible errors:
//
//	400 PASSWORD_RECOVERY_EXPIRED: The recovery code has expired.
//
// See https://core.telegram.org/method/auth.checkRecoveryPassword for reference.
func ( *Client) ( context.Context,  string) (bool, error) {
	var  BoolBox

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