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

// WalletExportSecretPhraseRequest represents TL type `wallet.exportSecretPhrase#9077c9ac`.
//
// See https://core.telegram.org/method/wallet.exportSecretPhrase for reference.
type WalletExportSecretPhraseRequest struct {
	// Flags field of WalletExportSecretPhraseRequest.
	Flags bin.Fields
	// Password field of WalletExportSecretPhraseRequest.
	//
	// Use SetPassword and GetPassword helpers.
	Password InputCheckPasswordSRPClass
}

// WalletExportSecretPhraseRequestTypeID is TL type id of WalletExportSecretPhraseRequest.
const WalletExportSecretPhraseRequestTypeID = 0x9077c9ac

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

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

	return true
}

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

// FillFrom fills WalletExportSecretPhraseRequest from given interface.
func ( *WalletExportSecretPhraseRequest) ( interface {
	() ( InputCheckPasswordSRPClass,  bool)
}) {
	if ,  := .();  {
		.Password = 
	}

}

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

// TypeName returns name of type in TL schema.
func (*WalletExportSecretPhraseRequest) () string {
	return "wallet.exportSecretPhrase"
}

// TypeInfo returns info about TL type.
func ( *WalletExportSecretPhraseRequest) () tdp.Type {
	 := tdp.Type{
		Name: "wallet.exportSecretPhrase",
		ID:   WalletExportSecretPhraseRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Password",
			SchemaName: "password",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *WalletExportSecretPhraseRequest) () {
	if !(.Password == nil) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *WalletExportSecretPhraseRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.exportSecretPhrase#9077c9ac as nil")
	}
	.PutID(WalletExportSecretPhraseRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WalletExportSecretPhraseRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode wallet.exportSecretPhrase#9077c9ac as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode wallet.exportSecretPhrase#9077c9ac: field flags: %w", )
	}
	if .Flags.Has(0) {
		if .Password == nil {
			return fmt.Errorf("unable to encode wallet.exportSecretPhrase#9077c9ac: field password is nil")
		}
		if  := .Password.Encode();  != nil {
			return fmt.Errorf("unable to encode wallet.exportSecretPhrase#9077c9ac: field password: %w", )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *WalletExportSecretPhraseRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.exportSecretPhrase#9077c9ac to nil")
	}
	if  := .ConsumeID(WalletExportSecretPhraseRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode wallet.exportSecretPhrase#9077c9ac: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *WalletExportSecretPhraseRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode wallet.exportSecretPhrase#9077c9ac to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode wallet.exportSecretPhrase#9077c9ac: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := DecodeInputCheckPasswordSRP()
		if  != nil {
			return fmt.Errorf("unable to decode wallet.exportSecretPhrase#9077c9ac: field password: %w", )
		}
		.Password = 
	}
	return nil
}

// SetPassword sets value of Password conditional field.
func ( *WalletExportSecretPhraseRequest) ( InputCheckPasswordSRPClass) {
	.Flags.Set(0)
	.Password = 
}

// GetPassword returns value of Password conditional field and
// boolean which is true if field was set.
func ( *WalletExportSecretPhraseRequest) () ( InputCheckPasswordSRPClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Password, true
}

// GetPasswordAsNotEmpty returns mapped value of Password conditional field and
// boolean which is true if field was set.
func ( *WalletExportSecretPhraseRequest) () (*InputCheckPasswordSRP, bool) {
	if ,  := .GetPassword();  {
		return .AsNotEmpty()
	}
	return nil, false
}

// WalletExportSecretPhrase invokes method wallet.exportSecretPhrase#9077c9ac returning error if any.
//
// See https://core.telegram.org/method/wallet.exportSecretPhrase for reference.
func ( *Client) ( context.Context,  *WalletExportSecretPhraseRequest) (*WalletSecretPhraseParts, error) {
	var  WalletSecretPhraseParts

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