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

// SecureSecretSettings represents TL type `secureSecretSettings#1527bcac`.
// Secure settings
//
// See https://core.telegram.org/constructor/secureSecretSettings for reference.
type SecureSecretSettings struct {
	// Secure KDF algo
	SecureAlgo SecurePasswordKdfAlgoClass
	// Secure secret
	SecureSecret []byte
	// Secret ID
	SecureSecretID int64
}

// SecureSecretSettingsTypeID is TL type id of SecureSecretSettings.
const SecureSecretSettingsTypeID = 0x1527bcac

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

func ( *SecureSecretSettings) () bool {
	if  == nil {
		return true
	}
	if !(.SecureAlgo == nil) {
		return false
	}
	if !(.SecureSecret == nil) {
		return false
	}
	if !(.SecureSecretID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills SecureSecretSettings from given interface.
func ( *SecureSecretSettings) ( interface {
	() ( SecurePasswordKdfAlgoClass)
	() ( []byte)
	() ( int64)
}) {
	.SecureAlgo = .()
	.SecureSecret = .()
	.SecureSecretID = .()
}

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

// TypeName returns name of type in TL schema.
func (*SecureSecretSettings) () string {
	return "secureSecretSettings"
}

// TypeInfo returns info about TL type.
func ( *SecureSecretSettings) () tdp.Type {
	 := tdp.Type{
		Name: "secureSecretSettings",
		ID:   SecureSecretSettingsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "SecureAlgo",
			SchemaName: "secure_algo",
		},
		{
			Name:       "SecureSecret",
			SchemaName: "secure_secret",
		},
		{
			Name:       "SecureSecretID",
			SchemaName: "secure_secret_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *SecureSecretSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode secureSecretSettings#1527bcac as nil")
	}
	.PutID(SecureSecretSettingsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *SecureSecretSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode secureSecretSettings#1527bcac as nil")
	}
	if .SecureAlgo == nil {
		return fmt.Errorf("unable to encode secureSecretSettings#1527bcac: field secure_algo is nil")
	}
	if  := .SecureAlgo.Encode();  != nil {
		return fmt.Errorf("unable to encode secureSecretSettings#1527bcac: field secure_algo: %w", )
	}
	.PutBytes(.SecureSecret)
	.PutLong(.SecureSecretID)
	return nil
}

// Decode implements bin.Decoder.
func ( *SecureSecretSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode secureSecretSettings#1527bcac to nil")
	}
	if  := .ConsumeID(SecureSecretSettingsTypeID);  != nil {
		return fmt.Errorf("unable to decode secureSecretSettings#1527bcac: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *SecureSecretSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode secureSecretSettings#1527bcac to nil")
	}
	{
		,  := DecodeSecurePasswordKdfAlgo()
		if  != nil {
			return fmt.Errorf("unable to decode secureSecretSettings#1527bcac: field secure_algo: %w", )
		}
		.SecureAlgo = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode secureSecretSettings#1527bcac: field secure_secret: %w", )
		}
		.SecureSecret = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode secureSecretSettings#1527bcac: field secure_secret_id: %w", )
		}
		.SecureSecretID = 
	}
	return nil
}

// GetSecureAlgo returns value of SecureAlgo field.
func ( *SecureSecretSettings) () ( SecurePasswordKdfAlgoClass) {
	if  == nil {
		return
	}
	return .SecureAlgo
}

// GetSecureSecret returns value of SecureSecret field.
func ( *SecureSecretSettings) () ( []byte) {
	if  == nil {
		return
	}
	return .SecureSecret
}

// GetSecureSecretID returns value of SecureSecretID field.
func ( *SecureSecretSettings) () ( int64) {
	if  == nil {
		return
	}
	return .SecureSecretID
}