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

// AccountGetPasswordSettingsRequest represents TL type `account.getPasswordSettings#9cd4eaf9`.
// Get private info associated to the password info (recovery email, telegram passport¹
// info & so on)
//
// Links:
//  1. https://core.telegram.org/passport
//
// See https://core.telegram.org/method/account.getPasswordSettings for reference.
type AccountGetPasswordSettingsRequest struct {
	// The password (see SRP¹)
	//
	// Links:
	//  1) https://core.telegram.org/api/srp
	Password InputCheckPasswordSRPClass
}

// AccountGetPasswordSettingsRequestTypeID is TL type id of AccountGetPasswordSettingsRequest.
const AccountGetPasswordSettingsRequestTypeID = 0x9cd4eaf9

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

func ( *AccountGetPasswordSettingsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Password == nil) {
		return false
	}

	return true
}

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

// FillFrom fills AccountGetPasswordSettingsRequest from given interface.
func ( *AccountGetPasswordSettingsRequest) ( interface {
	() ( InputCheckPasswordSRPClass)
}) {
	.Password = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountGetPasswordSettingsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.getPasswordSettings",
		ID:   AccountGetPasswordSettingsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Password",
			SchemaName: "password",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountGetPasswordSettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.getPasswordSettings#9cd4eaf9 as nil")
	}
	.PutID(AccountGetPasswordSettingsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountGetPasswordSettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.getPasswordSettings#9cd4eaf9 as nil")
	}
	if .Password == nil {
		return fmt.Errorf("unable to encode account.getPasswordSettings#9cd4eaf9: field password is nil")
	}
	if  := .Password.Encode();  != nil {
		return fmt.Errorf("unable to encode account.getPasswordSettings#9cd4eaf9: field password: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountGetPasswordSettingsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.getPasswordSettings#9cd4eaf9 to nil")
	}
	{
		,  := DecodeInputCheckPasswordSRP()
		if  != nil {
			return fmt.Errorf("unable to decode account.getPasswordSettings#9cd4eaf9: field password: %w", )
		}
		.Password = 
	}
	return nil
}

// GetPassword returns value of Password field.
func ( *AccountGetPasswordSettingsRequest) () ( InputCheckPasswordSRPClass) {
	if  == nil {
		return
	}
	return .Password
}

// GetPasswordAsNotEmpty returns mapped value of Password field.
func ( *AccountGetPasswordSettingsRequest) () (*InputCheckPasswordSRP, bool) {
	return .Password.AsNotEmpty()
}

// AccountGetPasswordSettings invokes method account.getPasswordSettings#9cd4eaf9 returning error if any.
// Get private info associated to the password info (recovery email, telegram passport¹
// info & so on)
//
// Links:
//  1. https://core.telegram.org/passport
//
// Possible errors:
//
//	400 PASSWORD_HASH_INVALID: The provided password hash is invalid.
//
// See https://core.telegram.org/method/account.getPasswordSettings for reference.
func ( *Client) ( context.Context,  InputCheckPasswordSRPClass) (*AccountPasswordSettings, error) {
	var  AccountPasswordSettings

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