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

// SecureValueHash represents TL type `secureValueHash#ed1ecdb0`.
// Secure value hash
//
// See https://core.telegram.org/constructor/secureValueHash for reference.
type SecureValueHash struct {
	// Secure value type
	Type SecureValueTypeClass
	// Hash
	Hash []byte
}

// SecureValueHashTypeID is TL type id of SecureValueHash.
const SecureValueHashTypeID = 0xed1ecdb0

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

func ( *SecureValueHash) () bool {
	if  == nil {
		return true
	}
	if !(.Type == nil) {
		return false
	}
	if !(.Hash == nil) {
		return false
	}

	return true
}

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

// FillFrom fills SecureValueHash from given interface.
func ( *SecureValueHash) ( interface {
	() ( SecureValueTypeClass)
	() ( []byte)
}) {
	.Type = .()
	.Hash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *SecureValueHash) () tdp.Type {
	 := tdp.Type{
		Name: "secureValueHash",
		ID:   SecureValueHashTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "Hash",
			SchemaName: "hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *SecureValueHash) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode secureValueHash#ed1ecdb0 as nil")
	}
	.PutID(SecureValueHashTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *SecureValueHash) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode secureValueHash#ed1ecdb0 as nil")
	}
	if .Type == nil {
		return fmt.Errorf("unable to encode secureValueHash#ed1ecdb0: field type is nil")
	}
	if  := .Type.Encode();  != nil {
		return fmt.Errorf("unable to encode secureValueHash#ed1ecdb0: field type: %w", )
	}
	.PutBytes(.Hash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *SecureValueHash) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode secureValueHash#ed1ecdb0 to nil")
	}
	{
		,  := DecodeSecureValueType()
		if  != nil {
			return fmt.Errorf("unable to decode secureValueHash#ed1ecdb0: field type: %w", )
		}
		.Type = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode secureValueHash#ed1ecdb0: field hash: %w", )
		}
		.Hash = 
	}
	return nil
}

// GetType returns value of Type field.
func ( *SecureValueHash) () ( SecureValueTypeClass) {
	if  == nil {
		return
	}
	return .Type
}

// GetHash returns value of Hash field.
func ( *SecureValueHash) () ( []byte) {
	if  == nil {
		return
	}
	return .Hash
}