// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strings"

	"go.uber.org/multierr"

	"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
	"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
)

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

// SecureValueTypePersonalDetails represents TL type `secureValueTypePersonalDetails#9d2a81e3`.
// Personal details
//
// See https://core.telegram.org/constructor/secureValueTypePersonalDetails for reference.
type SecureValueTypePersonalDetails struct {
}

// SecureValueTypePersonalDetailsTypeID is TL type id of SecureValueTypePersonalDetails.
const SecureValueTypePersonalDetailsTypeID = 0x9d2a81e3

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypePersonalDetails) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypePersonalDetails{}
)

func (s *SecureValueTypePersonalDetails) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypePersonalDetails) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypePersonalDetails",
		ID:   SecureValueTypePersonalDetailsTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypePersonalDetails) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypePersonalDetails#9d2a81e3 as nil")
	}
	b.PutID(SecureValueTypePersonalDetailsTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypePersonalDetails) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypePersonalDetails#9d2a81e3 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypePersonalDetails) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypePersonalDetails#9d2a81e3 to nil")
	}
	if err := b.ConsumeID(SecureValueTypePersonalDetailsTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypePersonalDetails#9d2a81e3: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypePersonalDetails) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypePersonalDetails#9d2a81e3 to nil")
	}
	return nil
}

// SecureValueTypePassport represents TL type `secureValueTypePassport#3dac6a00`.
// Passport
//
// See https://core.telegram.org/constructor/secureValueTypePassport for reference.
type SecureValueTypePassport struct {
}

// SecureValueTypePassportTypeID is TL type id of SecureValueTypePassport.
const SecureValueTypePassportTypeID = 0x3dac6a00

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypePassport) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypePassport{}
)

func (s *SecureValueTypePassport) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypePassport) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypePassport",
		ID:   SecureValueTypePassportTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypePassport) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypePassport#3dac6a00 as nil")
	}
	b.PutID(SecureValueTypePassportTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypePassport) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypePassport#3dac6a00 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypePassport) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypePassport#3dac6a00 to nil")
	}
	if err := b.ConsumeID(SecureValueTypePassportTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypePassport#3dac6a00: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypePassport) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypePassport#3dac6a00 to nil")
	}
	return nil
}

// SecureValueTypeDriverLicense represents TL type `secureValueTypeDriverLicense#6e425c4`.
// Driver's license
//
// See https://core.telegram.org/constructor/secureValueTypeDriverLicense for reference.
type SecureValueTypeDriverLicense struct {
}

// SecureValueTypeDriverLicenseTypeID is TL type id of SecureValueTypeDriverLicense.
const SecureValueTypeDriverLicenseTypeID = 0x6e425c4

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeDriverLicense) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeDriverLicense{}
)

func (s *SecureValueTypeDriverLicense) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeDriverLicense) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeDriverLicense",
		ID:   SecureValueTypeDriverLicenseTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeDriverLicense) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeDriverLicense#6e425c4 as nil")
	}
	b.PutID(SecureValueTypeDriverLicenseTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeDriverLicense) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeDriverLicense#6e425c4 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeDriverLicense) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeDriverLicense#6e425c4 to nil")
	}
	if err := b.ConsumeID(SecureValueTypeDriverLicenseTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeDriverLicense#6e425c4: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeDriverLicense) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeDriverLicense#6e425c4 to nil")
	}
	return nil
}

// SecureValueTypeIdentityCard represents TL type `secureValueTypeIdentityCard#a0d0744b`.
// Identity card
//
// See https://core.telegram.org/constructor/secureValueTypeIdentityCard for reference.
type SecureValueTypeIdentityCard struct {
}

// SecureValueTypeIdentityCardTypeID is TL type id of SecureValueTypeIdentityCard.
const SecureValueTypeIdentityCardTypeID = 0xa0d0744b

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeIdentityCard) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeIdentityCard{}
)

func (s *SecureValueTypeIdentityCard) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeIdentityCard) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeIdentityCard",
		ID:   SecureValueTypeIdentityCardTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeIdentityCard) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeIdentityCard#a0d0744b as nil")
	}
	b.PutID(SecureValueTypeIdentityCardTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeIdentityCard) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeIdentityCard#a0d0744b as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeIdentityCard) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeIdentityCard#a0d0744b to nil")
	}
	if err := b.ConsumeID(SecureValueTypeIdentityCardTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeIdentityCard#a0d0744b: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeIdentityCard) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeIdentityCard#a0d0744b to nil")
	}
	return nil
}

// SecureValueTypeInternalPassport represents TL type `secureValueTypeInternalPassport#99a48f23`.
// Internal passport¹
//
// Links:
//  1. https://core.telegram.org/passport
//
// See https://core.telegram.org/constructor/secureValueTypeInternalPassport for reference.
type SecureValueTypeInternalPassport struct {
}

// SecureValueTypeInternalPassportTypeID is TL type id of SecureValueTypeInternalPassport.
const SecureValueTypeInternalPassportTypeID = 0x99a48f23

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeInternalPassport) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeInternalPassport{}
)

func (s *SecureValueTypeInternalPassport) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeInternalPassport) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeInternalPassport",
		ID:   SecureValueTypeInternalPassportTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeInternalPassport) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeInternalPassport#99a48f23 as nil")
	}
	b.PutID(SecureValueTypeInternalPassportTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeInternalPassport) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeInternalPassport#99a48f23 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeInternalPassport) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeInternalPassport#99a48f23 to nil")
	}
	if err := b.ConsumeID(SecureValueTypeInternalPassportTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeInternalPassport#99a48f23: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeInternalPassport) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeInternalPassport#99a48f23 to nil")
	}
	return nil
}

// SecureValueTypeAddress represents TL type `secureValueTypeAddress#cbe31e26`.
// Address
//
// See https://core.telegram.org/constructor/secureValueTypeAddress for reference.
type SecureValueTypeAddress struct {
}

// SecureValueTypeAddressTypeID is TL type id of SecureValueTypeAddress.
const SecureValueTypeAddressTypeID = 0xcbe31e26

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeAddress) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeAddress{}
)

func (s *SecureValueTypeAddress) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeAddress) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeAddress",
		ID:   SecureValueTypeAddressTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeAddress) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeAddress#cbe31e26 as nil")
	}
	b.PutID(SecureValueTypeAddressTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeAddress) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeAddress#cbe31e26 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeAddress) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeAddress#cbe31e26 to nil")
	}
	if err := b.ConsumeID(SecureValueTypeAddressTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeAddress#cbe31e26: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeAddress) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeAddress#cbe31e26 to nil")
	}
	return nil
}

// SecureValueTypeUtilityBill represents TL type `secureValueTypeUtilityBill#fc36954e`.
// Utility bill
//
// See https://core.telegram.org/constructor/secureValueTypeUtilityBill for reference.
type SecureValueTypeUtilityBill struct {
}

// SecureValueTypeUtilityBillTypeID is TL type id of SecureValueTypeUtilityBill.
const SecureValueTypeUtilityBillTypeID = 0xfc36954e

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeUtilityBill) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeUtilityBill{}
)

func (s *SecureValueTypeUtilityBill) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeUtilityBill) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeUtilityBill",
		ID:   SecureValueTypeUtilityBillTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeUtilityBill) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeUtilityBill#fc36954e as nil")
	}
	b.PutID(SecureValueTypeUtilityBillTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeUtilityBill) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeUtilityBill#fc36954e as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeUtilityBill) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeUtilityBill#fc36954e to nil")
	}
	if err := b.ConsumeID(SecureValueTypeUtilityBillTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeUtilityBill#fc36954e: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeUtilityBill) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeUtilityBill#fc36954e to nil")
	}
	return nil
}

// SecureValueTypeBankStatement represents TL type `secureValueTypeBankStatement#89137c0d`.
// Bank statement
//
// See https://core.telegram.org/constructor/secureValueTypeBankStatement for reference.
type SecureValueTypeBankStatement struct {
}

// SecureValueTypeBankStatementTypeID is TL type id of SecureValueTypeBankStatement.
const SecureValueTypeBankStatementTypeID = 0x89137c0d

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeBankStatement) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeBankStatement{}
)

func (s *SecureValueTypeBankStatement) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeBankStatement) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeBankStatement",
		ID:   SecureValueTypeBankStatementTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeBankStatement) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeBankStatement#89137c0d as nil")
	}
	b.PutID(SecureValueTypeBankStatementTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeBankStatement) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeBankStatement#89137c0d as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeBankStatement) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeBankStatement#89137c0d to nil")
	}
	if err := b.ConsumeID(SecureValueTypeBankStatementTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeBankStatement#89137c0d: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeBankStatement) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeBankStatement#89137c0d to nil")
	}
	return nil
}

// SecureValueTypeRentalAgreement represents TL type `secureValueTypeRentalAgreement#8b883488`.
// Rental agreement
//
// See https://core.telegram.org/constructor/secureValueTypeRentalAgreement for reference.
type SecureValueTypeRentalAgreement struct {
}

// SecureValueTypeRentalAgreementTypeID is TL type id of SecureValueTypeRentalAgreement.
const SecureValueTypeRentalAgreementTypeID = 0x8b883488

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeRentalAgreement) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeRentalAgreement{}
)

func (s *SecureValueTypeRentalAgreement) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeRentalAgreement) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeRentalAgreement",
		ID:   SecureValueTypeRentalAgreementTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeRentalAgreement) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeRentalAgreement#8b883488 as nil")
	}
	b.PutID(SecureValueTypeRentalAgreementTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeRentalAgreement) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeRentalAgreement#8b883488 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeRentalAgreement) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeRentalAgreement#8b883488 to nil")
	}
	if err := b.ConsumeID(SecureValueTypeRentalAgreementTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeRentalAgreement#8b883488: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeRentalAgreement) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeRentalAgreement#8b883488 to nil")
	}
	return nil
}

// SecureValueTypePassportRegistration represents TL type `secureValueTypePassportRegistration#99e3806a`.
// Internal registration passport¹
//
// Links:
//  1. https://core.telegram.org/passport
//
// See https://core.telegram.org/constructor/secureValueTypePassportRegistration for reference.
type SecureValueTypePassportRegistration struct {
}

// SecureValueTypePassportRegistrationTypeID is TL type id of SecureValueTypePassportRegistration.
const SecureValueTypePassportRegistrationTypeID = 0x99e3806a

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypePassportRegistration) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypePassportRegistration{}
)

func (s *SecureValueTypePassportRegistration) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypePassportRegistration) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypePassportRegistration",
		ID:   SecureValueTypePassportRegistrationTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypePassportRegistration) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypePassportRegistration#99e3806a as nil")
	}
	b.PutID(SecureValueTypePassportRegistrationTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypePassportRegistration) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypePassportRegistration#99e3806a as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypePassportRegistration) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypePassportRegistration#99e3806a to nil")
	}
	if err := b.ConsumeID(SecureValueTypePassportRegistrationTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypePassportRegistration#99e3806a: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypePassportRegistration) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypePassportRegistration#99e3806a to nil")
	}
	return nil
}

// SecureValueTypeTemporaryRegistration represents TL type `secureValueTypeTemporaryRegistration#ea02ec33`.
// Temporary registration
//
// See https://core.telegram.org/constructor/secureValueTypeTemporaryRegistration for reference.
type SecureValueTypeTemporaryRegistration struct {
}

// SecureValueTypeTemporaryRegistrationTypeID is TL type id of SecureValueTypeTemporaryRegistration.
const SecureValueTypeTemporaryRegistrationTypeID = 0xea02ec33

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeTemporaryRegistration) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeTemporaryRegistration{}
)

func (s *SecureValueTypeTemporaryRegistration) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeTemporaryRegistration) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeTemporaryRegistration",
		ID:   SecureValueTypeTemporaryRegistrationTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeTemporaryRegistration) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeTemporaryRegistration#ea02ec33 as nil")
	}
	b.PutID(SecureValueTypeTemporaryRegistrationTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeTemporaryRegistration) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeTemporaryRegistration#ea02ec33 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeTemporaryRegistration) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeTemporaryRegistration#ea02ec33 to nil")
	}
	if err := b.ConsumeID(SecureValueTypeTemporaryRegistrationTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeTemporaryRegistration#ea02ec33: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeTemporaryRegistration) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeTemporaryRegistration#ea02ec33 to nil")
	}
	return nil
}

// SecureValueTypePhone represents TL type `secureValueTypePhone#b320aadb`.
// Phone
//
// See https://core.telegram.org/constructor/secureValueTypePhone for reference.
type SecureValueTypePhone struct {
}

// SecureValueTypePhoneTypeID is TL type id of SecureValueTypePhone.
const SecureValueTypePhoneTypeID = 0xb320aadb

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypePhone) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypePhone{}
)

func (s *SecureValueTypePhone) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypePhone) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypePhone",
		ID:   SecureValueTypePhoneTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypePhone) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypePhone#b320aadb as nil")
	}
	b.PutID(SecureValueTypePhoneTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypePhone) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypePhone#b320aadb as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypePhone) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypePhone#b320aadb to nil")
	}
	if err := b.ConsumeID(SecureValueTypePhoneTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypePhone#b320aadb: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypePhone) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypePhone#b320aadb to nil")
	}
	return nil
}

// SecureValueTypeEmail represents TL type `secureValueTypeEmail#8e3ca7ee`.
// Email
//
// See https://core.telegram.org/constructor/secureValueTypeEmail for reference.
type SecureValueTypeEmail struct {
}

// SecureValueTypeEmailTypeID is TL type id of SecureValueTypeEmail.
const SecureValueTypeEmailTypeID = 0x8e3ca7ee

// construct implements constructor of SecureValueTypeClass.
func (s SecureValueTypeEmail) construct() SecureValueTypeClass { return &s }

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

	_ SecureValueTypeClass = &SecureValueTypeEmail{}
)

func (s *SecureValueTypeEmail) Zero() bool {
	if s == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func (s *SecureValueTypeEmail) TypeInfo() tdp.Type {
	typ := tdp.Type{
		Name: "secureValueTypeEmail",
		ID:   SecureValueTypeEmailTypeID,
	}
	if s == nil {
		typ.Null = true
		return typ
	}
	typ.Fields = []tdp.Field{}
	return typ
}

// Encode implements bin.Encoder.
func (s *SecureValueTypeEmail) Encode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeEmail#8e3ca7ee as nil")
	}
	b.PutID(SecureValueTypeEmailTypeID)
	return s.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (s *SecureValueTypeEmail) EncodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't encode secureValueTypeEmail#8e3ca7ee as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (s *SecureValueTypeEmail) Decode(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeEmail#8e3ca7ee to nil")
	}
	if err := b.ConsumeID(SecureValueTypeEmailTypeID); err != nil {
		return fmt.Errorf("unable to decode secureValueTypeEmail#8e3ca7ee: %w", err)
	}
	return s.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (s *SecureValueTypeEmail) DecodeBare(b *bin.Buffer) error {
	if s == nil {
		return fmt.Errorf("can't decode secureValueTypeEmail#8e3ca7ee to nil")
	}
	return nil
}

// SecureValueTypeClassName is schema name of SecureValueTypeClass.
const SecureValueTypeClassName = "SecureValueType"

// SecureValueTypeClass represents SecureValueType generic type.
//
// See https://core.telegram.org/type/SecureValueType for reference.
//
// Example:
//
//	g, err := tg.DecodeSecureValueType(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.SecureValueTypePersonalDetails: // secureValueTypePersonalDetails#9d2a81e3
//	case *tg.SecureValueTypePassport: // secureValueTypePassport#3dac6a00
//	case *tg.SecureValueTypeDriverLicense: // secureValueTypeDriverLicense#6e425c4
//	case *tg.SecureValueTypeIdentityCard: // secureValueTypeIdentityCard#a0d0744b
//	case *tg.SecureValueTypeInternalPassport: // secureValueTypeInternalPassport#99a48f23
//	case *tg.SecureValueTypeAddress: // secureValueTypeAddress#cbe31e26
//	case *tg.SecureValueTypeUtilityBill: // secureValueTypeUtilityBill#fc36954e
//	case *tg.SecureValueTypeBankStatement: // secureValueTypeBankStatement#89137c0d
//	case *tg.SecureValueTypeRentalAgreement: // secureValueTypeRentalAgreement#8b883488
//	case *tg.SecureValueTypePassportRegistration: // secureValueTypePassportRegistration#99e3806a
//	case *tg.SecureValueTypeTemporaryRegistration: // secureValueTypeTemporaryRegistration#ea02ec33
//	case *tg.SecureValueTypePhone: // secureValueTypePhone#b320aadb
//	case *tg.SecureValueTypeEmail: // secureValueTypeEmail#8e3ca7ee
//	default: panic(v)
//	}
type SecureValueTypeClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() SecureValueTypeClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeSecureValueType implements binary de-serialization for SecureValueTypeClass.
func DecodeSecureValueType(buf *bin.Buffer) (SecureValueTypeClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case SecureValueTypePersonalDetailsTypeID:
		// Decoding secureValueTypePersonalDetails#9d2a81e3.
		v := SecureValueTypePersonalDetails{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypePassportTypeID:
		// Decoding secureValueTypePassport#3dac6a00.
		v := SecureValueTypePassport{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeDriverLicenseTypeID:
		// Decoding secureValueTypeDriverLicense#6e425c4.
		v := SecureValueTypeDriverLicense{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeIdentityCardTypeID:
		// Decoding secureValueTypeIdentityCard#a0d0744b.
		v := SecureValueTypeIdentityCard{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeInternalPassportTypeID:
		// Decoding secureValueTypeInternalPassport#99a48f23.
		v := SecureValueTypeInternalPassport{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeAddressTypeID:
		// Decoding secureValueTypeAddress#cbe31e26.
		v := SecureValueTypeAddress{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeUtilityBillTypeID:
		// Decoding secureValueTypeUtilityBill#fc36954e.
		v := SecureValueTypeUtilityBill{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeBankStatementTypeID:
		// Decoding secureValueTypeBankStatement#89137c0d.
		v := SecureValueTypeBankStatement{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeRentalAgreementTypeID:
		// Decoding secureValueTypeRentalAgreement#8b883488.
		v := SecureValueTypeRentalAgreement{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypePassportRegistrationTypeID:
		// Decoding secureValueTypePassportRegistration#99e3806a.
		v := SecureValueTypePassportRegistration{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeTemporaryRegistrationTypeID:
		// Decoding secureValueTypeTemporaryRegistration#ea02ec33.
		v := SecureValueTypeTemporaryRegistration{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypePhoneTypeID:
		// Decoding secureValueTypePhone#b320aadb.
		v := SecureValueTypePhone{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	case SecureValueTypeEmailTypeID:
		// Decoding secureValueTypeEmail#8e3ca7ee.
		v := SecureValueTypeEmail{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode SecureValueTypeClass: %w", bin.NewUnexpectedID(id))
	}
}

// SecureValueType boxes the SecureValueTypeClass providing a helper.
type SecureValueTypeBox struct {
	SecureValueType SecureValueTypeClass
}

// Decode implements bin.Decoder for SecureValueTypeBox.
func (b *SecureValueTypeBox) Decode(buf *bin.Buffer) error {
	if b == nil {
		return fmt.Errorf("unable to decode SecureValueTypeBox to nil")
	}
	v, err := DecodeSecureValueType(buf)
	if err != nil {
		return fmt.Errorf("unable to decode boxed value: %w", err)
	}
	b.SecureValueType = v
	return nil
}

// Encode implements bin.Encode for SecureValueTypeBox.
func (b *SecureValueTypeBox) Encode(buf *bin.Buffer) error {
	if b == nil || b.SecureValueType == nil {
		return fmt.Errorf("unable to encode SecureValueTypeClass as nil")
	}
	return b.SecureValueType.Encode(buf)
}
