package  tg 
 
import  ( 
	"context"  
	"errors"  
	"fmt"  
	"sort"  
	"strings"  
 
	"go.uber.org/multierr"  
 
	"github.com/gotd/td/bin"  
	"github.com/gotd/td/tdjson"  
	"github.com/gotd/td/tdp"  
	"github.com/gotd/td/tgerr"  
) 
 
 
var  ( 
	_ = bin .Buffer {} 
	_ = context .Background () 
	_ = fmt .Stringer (nil ) 
	_ = strings .Builder {} 
	_ = errors .Is  
	_ = multierr .AppendInto  
	_ = sort .Ints  
	_ = tdp .Format  
	_ = tgerr .Error {} 
	_ = tdjson .Encoder {} 
) 
 
 
 
 
 
type  AccountPasswordInputSettings  struct  { 
	 
 
 
 
	Flags  bin .Fields  
	 
 
 
 
 
 
	NewAlgo  PasswordKdfAlgoClass  
	 
 
 
 
 
 
	NewPasswordHash  []byte  
	 
 
 
	Hint  string  
	 
 
 
	Email  string  
	 
 
 
 
 
 
	NewSecureSettings  SecureSecretSettings  
} 
 
 
const  AccountPasswordInputSettingsTypeID  = 0xc23727c9  
 
 
var  ( 
	_ bin .Encoder      = &AccountPasswordInputSettings {} 
	_ bin .Decoder      = &AccountPasswordInputSettings {} 
	_ bin .BareEncoder  = &AccountPasswordInputSettings {} 
	_ bin .BareDecoder  = &AccountPasswordInputSettings {} 
) 
 
func  (p  *AccountPasswordInputSettings ) Zero  () bool  { 
	if  p  == nil  { 
		return  true  
	} 
	if  !(p .Flags .Zero ()) { 
		return  false  
	} 
	if  !(p .NewAlgo  == nil ) { 
		return  false  
	} 
	if  !(p .NewPasswordHash  == nil ) { 
		return  false  
	} 
	if  !(p .Hint  == "" ) { 
		return  false  
	} 
	if  !(p .Email  == "" ) { 
		return  false  
	} 
	if  !(p .NewSecureSettings .Zero ()) { 
		return  false  
	} 
 
	return  true  
} 
 
 
func  (p  *AccountPasswordInputSettings ) String  () string  { 
	if  p  == nil  { 
		return  "AccountPasswordInputSettings(nil)"  
	} 
	type  Alias  AccountPasswordInputSettings  
	return  fmt .Sprintf ("AccountPasswordInputSettings%+v" , Alias (*p )) 
} 
 
 
func  (p  *AccountPasswordInputSettings ) FillFrom  (from  interface  { 
	GetNewAlgo () (value  PasswordKdfAlgoClass , ok  bool ) 
	GetNewPasswordHash () (value  []byte , ok  bool ) 
	GetHint () (value  string , ok  bool ) 
	GetEmail () (value  string , ok  bool ) 
	GetNewSecureSettings () (value  SecureSecretSettings , ok  bool ) 
}) { 
	if  val , ok  := from .GetNewAlgo (); ok  { 
		p .NewAlgo  = val  
	} 
 
	if  val , ok  := from .GetNewPasswordHash (); ok  { 
		p .NewPasswordHash  = val  
	} 
 
	if  val , ok  := from .GetHint (); ok  { 
		p .Hint  = val  
	} 
 
	if  val , ok  := from .GetEmail (); ok  { 
		p .Email  = val  
	} 
 
	if  val , ok  := from .GetNewSecureSettings (); ok  { 
		p .NewSecureSettings  = val  
	} 
 
} 
 
 
 
 
func  (*AccountPasswordInputSettings ) TypeID  () uint32  { 
	return  AccountPasswordInputSettingsTypeID  
} 
 
 
func  (*AccountPasswordInputSettings ) TypeName  () string  { 
	return  "account.passwordInputSettings"  
} 
 
 
func  (p  *AccountPasswordInputSettings ) TypeInfo  () tdp .Type  { 
	typ  := tdp .Type { 
		Name : "account.passwordInputSettings" , 
		ID :   AccountPasswordInputSettingsTypeID , 
	} 
	if  p  == nil  { 
		typ .Null  = true  
		return  typ  
	} 
	typ .Fields  = []tdp .Field { 
		{ 
			Name :       "NewAlgo" , 
			SchemaName : "new_algo" , 
			Null :       !p .Flags .Has (0 ), 
		}, 
		{ 
			Name :       "NewPasswordHash" , 
			SchemaName : "new_password_hash" , 
			Null :       !p .Flags .Has (0 ), 
		}, 
		{ 
			Name :       "Hint" , 
			SchemaName : "hint" , 
			Null :       !p .Flags .Has (0 ), 
		}, 
		{ 
			Name :       "Email" , 
			SchemaName : "email" , 
			Null :       !p .Flags .Has (1 ), 
		}, 
		{ 
			Name :       "NewSecureSettings" , 
			SchemaName : "new_secure_settings" , 
			Null :       !p .Flags .Has (2 ), 
		}, 
	} 
	return  typ  
} 
 
 
func  (p  *AccountPasswordInputSettings ) SetFlags  () { 
	if  !(p .NewAlgo  == nil ) { 
		p .Flags .Set (0 ) 
	} 
	if  !(p .NewPasswordHash  == nil ) { 
		p .Flags .Set (0 ) 
	} 
	if  !(p .Hint  == "" ) { 
		p .Flags .Set (0 ) 
	} 
	if  !(p .Email  == "" ) { 
		p .Flags .Set (1 ) 
	} 
	if  !(p .NewSecureSettings .Zero ()) { 
		p .Flags .Set (2 ) 
	} 
} 
 
 
func  (p  *AccountPasswordInputSettings ) Encode  (b  *bin .Buffer ) error  { 
	if  p  == nil  { 
		return  fmt .Errorf ("can't encode account.passwordInputSettings#c23727c9 as nil" ) 
	} 
	b .PutID (AccountPasswordInputSettingsTypeID ) 
	return  p .EncodeBare (b ) 
} 
 
 
func  (p  *AccountPasswordInputSettings ) EncodeBare  (b  *bin .Buffer ) error  { 
	if  p  == nil  { 
		return  fmt .Errorf ("can't encode account.passwordInputSettings#c23727c9 as nil" ) 
	} 
	p .SetFlags () 
	if  err  := p .Flags .Encode (b ); err  != nil  { 
		return  fmt .Errorf ("unable to encode account.passwordInputSettings#c23727c9: field flags: %w" , err ) 
	} 
	if  p .Flags .Has (0 ) { 
		if  p .NewAlgo  == nil  { 
			return  fmt .Errorf ("unable to encode account.passwordInputSettings#c23727c9: field new_algo is nil" ) 
		} 
		if  err  := p .NewAlgo .Encode (b ); err  != nil  { 
			return  fmt .Errorf ("unable to encode account.passwordInputSettings#c23727c9: field new_algo: %w" , err ) 
		} 
	} 
	if  p .Flags .Has (0 ) { 
		b .PutBytes (p .NewPasswordHash ) 
	} 
	if  p .Flags .Has (0 ) { 
		b .PutString (p .Hint ) 
	} 
	if  p .Flags .Has (1 ) { 
		b .PutString (p .Email ) 
	} 
	if  p .Flags .Has (2 ) { 
		if  err  := p .NewSecureSettings .Encode (b ); err  != nil  { 
			return  fmt .Errorf ("unable to encode account.passwordInputSettings#c23727c9: field new_secure_settings: %w" , err ) 
		} 
	} 
	return  nil  
} 
 
 
func  (p  *AccountPasswordInputSettings ) Decode  (b  *bin .Buffer ) error  { 
	if  p  == nil  { 
		return  fmt .Errorf ("can't decode account.passwordInputSettings#c23727c9 to nil" ) 
	} 
	if  err  := b .ConsumeID (AccountPasswordInputSettingsTypeID ); err  != nil  { 
		return  fmt .Errorf ("unable to decode account.passwordInputSettings#c23727c9: %w" , err ) 
	} 
	return  p .DecodeBare (b ) 
} 
 
 
func  (p  *AccountPasswordInputSettings ) DecodeBare  (b  *bin .Buffer ) error  { 
	if  p  == nil  { 
		return  fmt .Errorf ("can't decode account.passwordInputSettings#c23727c9 to nil" ) 
	} 
	{ 
		if  err  := p .Flags .Decode (b ); err  != nil  { 
			return  fmt .Errorf ("unable to decode account.passwordInputSettings#c23727c9: field flags: %w" , err ) 
		} 
	} 
	if  p .Flags .Has (0 ) { 
		value , err  := DecodePasswordKdfAlgo (b ) 
		if  err  != nil  { 
			return  fmt .Errorf ("unable to decode account.passwordInputSettings#c23727c9: field new_algo: %w" , err ) 
		} 
		p .NewAlgo  = value  
	} 
	if  p .Flags .Has (0 ) { 
		value , err  := b .Bytes () 
		if  err  != nil  { 
			return  fmt .Errorf ("unable to decode account.passwordInputSettings#c23727c9: field new_password_hash: %w" , err ) 
		} 
		p .NewPasswordHash  = value  
	} 
	if  p .Flags .Has (0 ) { 
		value , err  := b .String () 
		if  err  != nil  { 
			return  fmt .Errorf ("unable to decode account.passwordInputSettings#c23727c9: field hint: %w" , err ) 
		} 
		p .Hint  = value  
	} 
	if  p .Flags .Has (1 ) { 
		value , err  := b .String () 
		if  err  != nil  { 
			return  fmt .Errorf ("unable to decode account.passwordInputSettings#c23727c9: field email: %w" , err ) 
		} 
		p .Email  = value  
	} 
	if  p .Flags .Has (2 ) { 
		if  err  := p .NewSecureSettings .Decode (b ); err  != nil  { 
			return  fmt .Errorf ("unable to decode account.passwordInputSettings#c23727c9: field new_secure_settings: %w" , err ) 
		} 
	} 
	return  nil  
} 
 
 
func  (p  *AccountPasswordInputSettings ) SetNewAlgo  (value  PasswordKdfAlgoClass ) { 
	p .Flags .Set (0 ) 
	p .NewAlgo  = value  
} 
 
 
 
func  (p  *AccountPasswordInputSettings ) GetNewAlgo  () (value  PasswordKdfAlgoClass , ok  bool ) { 
	if  p  == nil  { 
		return  
	} 
	if  !p .Flags .Has (0 ) { 
		return  value , false  
	} 
	return  p .NewAlgo , true  
} 
 
 
func  (p  *AccountPasswordInputSettings ) SetNewPasswordHash  (value  []byte ) { 
	p .Flags .Set (0 ) 
	p .NewPasswordHash  = value  
} 
 
 
 
func  (p  *AccountPasswordInputSettings ) GetNewPasswordHash  () (value  []byte , ok  bool ) { 
	if  p  == nil  { 
		return  
	} 
	if  !p .Flags .Has (0 ) { 
		return  value , false  
	} 
	return  p .NewPasswordHash , true  
} 
 
 
func  (p  *AccountPasswordInputSettings ) SetHint  (value  string ) { 
	p .Flags .Set (0 ) 
	p .Hint  = value  
} 
 
 
 
func  (p  *AccountPasswordInputSettings ) GetHint  () (value  string , ok  bool ) { 
	if  p  == nil  { 
		return  
	} 
	if  !p .Flags .Has (0 ) { 
		return  value , false  
	} 
	return  p .Hint , true  
} 
 
 
func  (p  *AccountPasswordInputSettings ) SetEmail  (value  string ) { 
	p .Flags .Set (1 ) 
	p .Email  = value  
} 
 
 
 
func  (p  *AccountPasswordInputSettings ) GetEmail  () (value  string , ok  bool ) { 
	if  p  == nil  { 
		return  
	} 
	if  !p .Flags .Has (1 ) { 
		return  value , false  
	} 
	return  p .Email , true  
} 
 
 
func  (p  *AccountPasswordInputSettings ) SetNewSecureSettings  (value  SecureSecretSettings ) { 
	p .Flags .Set (2 ) 
	p .NewSecureSettings  = value  
} 
 
 
 
func  (p  *AccountPasswordInputSettings ) GetNewSecureSettings  () (value  SecureSecretSettings , ok  bool ) { 
	if  p  == nil  { 
		return  
	} 
	if  !p .Flags .Has (2 ) { 
		return  value , false  
	} 
	return  p .NewSecureSettings , true  
} 
  
The pages are generated with Golds   v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds  is a Go 101  project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1  (reachable from the left QR code) to get the latest news of Golds .