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

// SecureData represents TL type `secureData#8aeabec3`.
// Secure passport¹ data, for more info see the passport docs »²
//
// Links:
//  1. https://core.telegram.org/passport
//  2. https://core.telegram.org/passport/encryption#securedata
//
// See https://core.telegram.org/constructor/secureData for reference.
type SecureData struct {
	// Data
	Data []byte
	// Data hash
	DataHash []byte
	// Secret
	Secret []byte
}

// SecureDataTypeID is TL type id of SecureData.
const SecureDataTypeID = 0x8aeabec3

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

func ( *SecureData) () bool {
	if  == nil {
		return true
	}
	if !(.Data == nil) {
		return false
	}
	if !(.DataHash == nil) {
		return false
	}
	if !(.Secret == nil) {
		return false
	}

	return true
}

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

// FillFrom fills SecureData from given interface.
func ( *SecureData) ( interface {
	() ( []byte)
	() ( []byte)
	() ( []byte)
}) {
	.Data = .()
	.DataHash = .()
	.Secret = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *SecureData) () tdp.Type {
	 := tdp.Type{
		Name: "secureData",
		ID:   SecureDataTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Data",
			SchemaName: "data",
		},
		{
			Name:       "DataHash",
			SchemaName: "data_hash",
		},
		{
			Name:       "Secret",
			SchemaName: "secret",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *SecureData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode secureData#8aeabec3 as nil")
	}
	.PutID(SecureDataTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *SecureData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode secureData#8aeabec3 as nil")
	}
	.PutBytes(.Data)
	.PutBytes(.DataHash)
	.PutBytes(.Secret)
	return nil
}

// Decode implements bin.Decoder.
func ( *SecureData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode secureData#8aeabec3 to nil")
	}
	if  := .ConsumeID(SecureDataTypeID);  != nil {
		return fmt.Errorf("unable to decode secureData#8aeabec3: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *SecureData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode secureData#8aeabec3 to nil")
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode secureData#8aeabec3: field data: %w", )
		}
		.Data = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode secureData#8aeabec3: field data_hash: %w", )
		}
		.DataHash = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode secureData#8aeabec3: field secret: %w", )
		}
		.Secret = 
	}
	return nil
}

// GetData returns value of Data field.
func ( *SecureData) () ( []byte) {
	if  == nil {
		return
	}
	return .Data
}

// GetDataHash returns value of DataHash field.
func ( *SecureData) () ( []byte) {
	if  == nil {
		return
	}
	return .DataHash
}

// GetSecret returns value of Secret field.
func ( *SecureData) () ( []byte) {
	if  == nil {
		return
	}
	return .Secret
}