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

// InputPrivacyKeyStatusTimestamp represents TL type `inputPrivacyKeyStatusTimestamp#4f96cb18`.
// Whether people will be able to see our exact last online timestamp.
// Note that if we decide to hide our exact last online timestamp to someone (i.e., users
// A, B, C, or all users) and we do not have a Premium¹ subscription, we won't be able
// to see the exact last online timestamp of those users (A, B, C, or all users), even if
// those users do share it with us.
// If those users do share their exact online status with us, but we can't see it due to
// the reason mentioned above, the by_me flag of userStatusRecently¹,
// userStatusLastWeek², userStatusLastMonth³ will be set.
//
// Links:
//  1. https://core.telegram.org/api/premium
//  2. https://core.telegram.org/constructor/userStatusRecently
//  3. https://core.telegram.org/constructor/userStatusLastWeek
//  4. https://core.telegram.org/constructor/userStatusLastMonth
//
// See https://core.telegram.org/constructor/inputPrivacyKeyStatusTimestamp for reference.
type InputPrivacyKeyStatusTimestamp struct {
}

// InputPrivacyKeyStatusTimestampTypeID is TL type id of InputPrivacyKeyStatusTimestamp.
const InputPrivacyKeyStatusTimestampTypeID = 0x4f96cb18

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyStatusTimestamp) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyStatusTimestamp{}
)

func (i *InputPrivacyKeyStatusTimestamp) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyStatusTimestamp) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyStatusTimestamp#4f96cb18 as nil")
	}
	b.PutID(InputPrivacyKeyStatusTimestampTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyStatusTimestamp) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyStatusTimestamp#4f96cb18 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyStatusTimestamp) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyStatusTimestamp#4f96cb18 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyStatusTimestampTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyStatusTimestamp#4f96cb18: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyStatusTimestamp) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyStatusTimestamp#4f96cb18 to nil")
	}
	return nil
}

// InputPrivacyKeyChatInvite represents TL type `inputPrivacyKeyChatInvite#bdfb0426`.
// Whether people will be able to invite you to chats
//
// See https://core.telegram.org/constructor/inputPrivacyKeyChatInvite for reference.
type InputPrivacyKeyChatInvite struct {
}

// InputPrivacyKeyChatInviteTypeID is TL type id of InputPrivacyKeyChatInvite.
const InputPrivacyKeyChatInviteTypeID = 0xbdfb0426

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyChatInvite) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyChatInvite{}
)

func (i *InputPrivacyKeyChatInvite) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyChatInvite) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyChatInvite#bdfb0426 as nil")
	}
	b.PutID(InputPrivacyKeyChatInviteTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyChatInvite) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyChatInvite#bdfb0426 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyChatInvite) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyChatInvite#bdfb0426 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyChatInviteTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyChatInvite#bdfb0426: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyChatInvite) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyChatInvite#bdfb0426 to nil")
	}
	return nil
}

// InputPrivacyKeyPhoneCall represents TL type `inputPrivacyKeyPhoneCall#fabadc5f`.
// Whether you will accept phone calls
//
// See https://core.telegram.org/constructor/inputPrivacyKeyPhoneCall for reference.
type InputPrivacyKeyPhoneCall struct {
}

// InputPrivacyKeyPhoneCallTypeID is TL type id of InputPrivacyKeyPhoneCall.
const InputPrivacyKeyPhoneCallTypeID = 0xfabadc5f

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyPhoneCall) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyPhoneCall{}
)

func (i *InputPrivacyKeyPhoneCall) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyPhoneCall) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyPhoneCall#fabadc5f as nil")
	}
	b.PutID(InputPrivacyKeyPhoneCallTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyPhoneCall) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyPhoneCall#fabadc5f as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyPhoneCall) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyPhoneCall#fabadc5f to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyPhoneCallTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyPhoneCall#fabadc5f: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyPhoneCall) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyPhoneCall#fabadc5f to nil")
	}
	return nil
}

// InputPrivacyKeyPhoneP2P represents TL type `inputPrivacyKeyPhoneP2P#db9e70d2`.
// Whether to allow P2P communication during VoIP calls
//
// See https://core.telegram.org/constructor/inputPrivacyKeyPhoneP2P for reference.
type InputPrivacyKeyPhoneP2P struct {
}

// InputPrivacyKeyPhoneP2PTypeID is TL type id of InputPrivacyKeyPhoneP2P.
const InputPrivacyKeyPhoneP2PTypeID = 0xdb9e70d2

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyPhoneP2P) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyPhoneP2P{}
)

func (i *InputPrivacyKeyPhoneP2P) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyPhoneP2P) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyPhoneP2P#db9e70d2 as nil")
	}
	b.PutID(InputPrivacyKeyPhoneP2PTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyPhoneP2P) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyPhoneP2P#db9e70d2 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyPhoneP2P) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyPhoneP2P#db9e70d2 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyPhoneP2PTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyPhoneP2P#db9e70d2: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyPhoneP2P) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyPhoneP2P#db9e70d2 to nil")
	}
	return nil
}

// InputPrivacyKeyForwards represents TL type `inputPrivacyKeyForwards#a4dd4c08`.
// Whether messages forwarded from you will be anonymous¹
//
// Links:
//  1. https://telegram.org/blog/unsend-privacy-emoji#anonymous-forwarding
//
// See https://core.telegram.org/constructor/inputPrivacyKeyForwards for reference.
type InputPrivacyKeyForwards struct {
}

// InputPrivacyKeyForwardsTypeID is TL type id of InputPrivacyKeyForwards.
const InputPrivacyKeyForwardsTypeID = 0xa4dd4c08

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyForwards) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyForwards{}
)

func (i *InputPrivacyKeyForwards) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyForwards) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyForwards#a4dd4c08 as nil")
	}
	b.PutID(InputPrivacyKeyForwardsTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyForwards) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyForwards#a4dd4c08 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyForwards) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyForwards#a4dd4c08 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyForwardsTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyForwards#a4dd4c08: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyForwards) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyForwards#a4dd4c08 to nil")
	}
	return nil
}

// InputPrivacyKeyProfilePhoto represents TL type `inputPrivacyKeyProfilePhoto#5719bacc`.
// Whether people will be able to see your profile picture
//
// See https://core.telegram.org/constructor/inputPrivacyKeyProfilePhoto for reference.
type InputPrivacyKeyProfilePhoto struct {
}

// InputPrivacyKeyProfilePhotoTypeID is TL type id of InputPrivacyKeyProfilePhoto.
const InputPrivacyKeyProfilePhotoTypeID = 0x5719bacc

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyProfilePhoto) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyProfilePhoto{}
)

func (i *InputPrivacyKeyProfilePhoto) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyProfilePhoto) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyProfilePhoto#5719bacc as nil")
	}
	b.PutID(InputPrivacyKeyProfilePhotoTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyProfilePhoto) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyProfilePhoto#5719bacc as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyProfilePhoto) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyProfilePhoto#5719bacc to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyProfilePhotoTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyProfilePhoto#5719bacc: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyProfilePhoto) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyProfilePhoto#5719bacc to nil")
	}
	return nil
}

// InputPrivacyKeyPhoneNumber represents TL type `inputPrivacyKeyPhoneNumber#352dafa`.
// Whether people will be able to see your phone number
//
// See https://core.telegram.org/constructor/inputPrivacyKeyPhoneNumber for reference.
type InputPrivacyKeyPhoneNumber struct {
}

// InputPrivacyKeyPhoneNumberTypeID is TL type id of InputPrivacyKeyPhoneNumber.
const InputPrivacyKeyPhoneNumberTypeID = 0x352dafa

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyPhoneNumber) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyPhoneNumber{}
)

func (i *InputPrivacyKeyPhoneNumber) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyPhoneNumber) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyPhoneNumber#352dafa as nil")
	}
	b.PutID(InputPrivacyKeyPhoneNumberTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyPhoneNumber) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyPhoneNumber#352dafa as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyPhoneNumber) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyPhoneNumber#352dafa to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyPhoneNumberTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyPhoneNumber#352dafa: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyPhoneNumber) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyPhoneNumber#352dafa to nil")
	}
	return nil
}

// InputPrivacyKeyAddedByPhone represents TL type `inputPrivacyKeyAddedByPhone#d1219bdd`.
// Whether people can add you to their contact list by your phone number
//
// See https://core.telegram.org/constructor/inputPrivacyKeyAddedByPhone for reference.
type InputPrivacyKeyAddedByPhone struct {
}

// InputPrivacyKeyAddedByPhoneTypeID is TL type id of InputPrivacyKeyAddedByPhone.
const InputPrivacyKeyAddedByPhoneTypeID = 0xd1219bdd

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyAddedByPhone) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyAddedByPhone{}
)

func (i *InputPrivacyKeyAddedByPhone) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyAddedByPhone) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyAddedByPhone#d1219bdd as nil")
	}
	b.PutID(InputPrivacyKeyAddedByPhoneTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyAddedByPhone) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyAddedByPhone#d1219bdd as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyAddedByPhone) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyAddedByPhone#d1219bdd to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyAddedByPhoneTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyAddedByPhone#d1219bdd: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyAddedByPhone) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyAddedByPhone#d1219bdd to nil")
	}
	return nil
}

// InputPrivacyKeyVoiceMessages represents TL type `inputPrivacyKeyVoiceMessages#aee69d68`.
// Whether people can send you voice messages or round videos (Premium¹ users only).
//
// Links:
//  1. https://core.telegram.org/api/premium
//
// See https://core.telegram.org/constructor/inputPrivacyKeyVoiceMessages for reference.
type InputPrivacyKeyVoiceMessages struct {
}

// InputPrivacyKeyVoiceMessagesTypeID is TL type id of InputPrivacyKeyVoiceMessages.
const InputPrivacyKeyVoiceMessagesTypeID = 0xaee69d68

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyVoiceMessages) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyVoiceMessages{}
)

func (i *InputPrivacyKeyVoiceMessages) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyVoiceMessages) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyVoiceMessages#aee69d68 as nil")
	}
	b.PutID(InputPrivacyKeyVoiceMessagesTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyVoiceMessages) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyVoiceMessages#aee69d68 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyVoiceMessages) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyVoiceMessages#aee69d68 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyVoiceMessagesTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyVoiceMessages#aee69d68: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyVoiceMessages) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyVoiceMessages#aee69d68 to nil")
	}
	return nil
}

// InputPrivacyKeyAbout represents TL type `inputPrivacyKeyAbout#3823cc40`.
// Whether people can see your bio
//
// See https://core.telegram.org/constructor/inputPrivacyKeyAbout for reference.
type InputPrivacyKeyAbout struct {
}

// InputPrivacyKeyAboutTypeID is TL type id of InputPrivacyKeyAbout.
const InputPrivacyKeyAboutTypeID = 0x3823cc40

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyAbout) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyAbout{}
)

func (i *InputPrivacyKeyAbout) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyAbout) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyAbout#3823cc40 as nil")
	}
	b.PutID(InputPrivacyKeyAboutTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyAbout) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyAbout#3823cc40 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyAbout) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyAbout#3823cc40 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyAboutTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyAbout#3823cc40: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyAbout) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyAbout#3823cc40 to nil")
	}
	return nil
}

// InputPrivacyKeyBirthday represents TL type `inputPrivacyKeyBirthday#d65a11cc`.
// Whether the user can see our birthday.
//
// See https://core.telegram.org/constructor/inputPrivacyKeyBirthday for reference.
type InputPrivacyKeyBirthday struct {
}

// InputPrivacyKeyBirthdayTypeID is TL type id of InputPrivacyKeyBirthday.
const InputPrivacyKeyBirthdayTypeID = 0xd65a11cc

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyBirthday) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyBirthday{}
)

func (i *InputPrivacyKeyBirthday) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyBirthday) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyBirthday#d65a11cc as nil")
	}
	b.PutID(InputPrivacyKeyBirthdayTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyBirthday) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyBirthday#d65a11cc as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyBirthday) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyBirthday#d65a11cc to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyBirthdayTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyBirthday#d65a11cc: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyBirthday) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyBirthday#d65a11cc to nil")
	}
	return nil
}

// InputPrivacyKeyStarGiftsAutoSave represents TL type `inputPrivacyKeyStarGiftsAutoSave#e1732341`.
// Whether received gifts¹ will be automatically displayed on our profile
//
// Links:
//  1. https://core.telegram.org/api/gifts
//
// See https://core.telegram.org/constructor/inputPrivacyKeyStarGiftsAutoSave for reference.
type InputPrivacyKeyStarGiftsAutoSave struct {
}

// InputPrivacyKeyStarGiftsAutoSaveTypeID is TL type id of InputPrivacyKeyStarGiftsAutoSave.
const InputPrivacyKeyStarGiftsAutoSaveTypeID = 0xe1732341

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyStarGiftsAutoSave) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyStarGiftsAutoSave{}
)

func (i *InputPrivacyKeyStarGiftsAutoSave) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyStarGiftsAutoSave) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyStarGiftsAutoSave#e1732341 as nil")
	}
	b.PutID(InputPrivacyKeyStarGiftsAutoSaveTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyStarGiftsAutoSave) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyStarGiftsAutoSave#e1732341 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyStarGiftsAutoSave) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyStarGiftsAutoSave#e1732341 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyStarGiftsAutoSaveTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyStarGiftsAutoSave#e1732341: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyStarGiftsAutoSave) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyStarGiftsAutoSave#e1732341 to nil")
	}
	return nil
}

// InputPrivacyKeyNoPaidMessages represents TL type `inputPrivacyKeyNoPaidMessages#bdc597b4`.
// Who can send you messages without paying, if paid messages »¹ are enabled.
//
// Links:
//  1. https://core.telegram.org/api/paid-messages
//
// See https://core.telegram.org/constructor/inputPrivacyKeyNoPaidMessages for reference.
type InputPrivacyKeyNoPaidMessages struct {
}

// InputPrivacyKeyNoPaidMessagesTypeID is TL type id of InputPrivacyKeyNoPaidMessages.
const InputPrivacyKeyNoPaidMessagesTypeID = 0xbdc597b4

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeyNoPaidMessages) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeyNoPaidMessages{}
)

func (i *InputPrivacyKeyNoPaidMessages) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeyNoPaidMessages) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyNoPaidMessages#bdc597b4 as nil")
	}
	b.PutID(InputPrivacyKeyNoPaidMessagesTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeyNoPaidMessages) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeyNoPaidMessages#bdc597b4 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeyNoPaidMessages) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyNoPaidMessages#bdc597b4 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeyNoPaidMessagesTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeyNoPaidMessages#bdc597b4: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeyNoPaidMessages) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeyNoPaidMessages#bdc597b4 to nil")
	}
	return nil
}

// InputPrivacyKeySavedMusic represents TL type `inputPrivacyKeySavedMusic#4dbe9226`.
//
// See https://core.telegram.org/constructor/inputPrivacyKeySavedMusic for reference.
type InputPrivacyKeySavedMusic struct {
}

// InputPrivacyKeySavedMusicTypeID is TL type id of InputPrivacyKeySavedMusic.
const InputPrivacyKeySavedMusicTypeID = 0x4dbe9226

// construct implements constructor of InputPrivacyKeyClass.
func (i InputPrivacyKeySavedMusic) construct() InputPrivacyKeyClass { return &i }

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

	_ InputPrivacyKeyClass = &InputPrivacyKeySavedMusic{}
)

func (i *InputPrivacyKeySavedMusic) Zero() bool {
	if i == nil {
		return true
	}

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func (i *InputPrivacyKeySavedMusic) Encode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeySavedMusic#4dbe9226 as nil")
	}
	b.PutID(InputPrivacyKeySavedMusicTypeID)
	return i.EncodeBare(b)
}

// EncodeBare implements bin.BareEncoder.
func (i *InputPrivacyKeySavedMusic) EncodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't encode inputPrivacyKeySavedMusic#4dbe9226 as nil")
	}
	return nil
}

// Decode implements bin.Decoder.
func (i *InputPrivacyKeySavedMusic) Decode(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeySavedMusic#4dbe9226 to nil")
	}
	if err := b.ConsumeID(InputPrivacyKeySavedMusicTypeID); err != nil {
		return fmt.Errorf("unable to decode inputPrivacyKeySavedMusic#4dbe9226: %w", err)
	}
	return i.DecodeBare(b)
}

// DecodeBare implements bin.BareDecoder.
func (i *InputPrivacyKeySavedMusic) DecodeBare(b *bin.Buffer) error {
	if i == nil {
		return fmt.Errorf("can't decode inputPrivacyKeySavedMusic#4dbe9226 to nil")
	}
	return nil
}

// InputPrivacyKeyClassName is schema name of InputPrivacyKeyClass.
const InputPrivacyKeyClassName = "InputPrivacyKey"

// InputPrivacyKeyClass represents InputPrivacyKey generic type.
//
// See https://core.telegram.org/type/InputPrivacyKey for reference.
//
// Example:
//
//	g, err := tg.DecodeInputPrivacyKey(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputPrivacyKeyStatusTimestamp: // inputPrivacyKeyStatusTimestamp#4f96cb18
//	case *tg.InputPrivacyKeyChatInvite: // inputPrivacyKeyChatInvite#bdfb0426
//	case *tg.InputPrivacyKeyPhoneCall: // inputPrivacyKeyPhoneCall#fabadc5f
//	case *tg.InputPrivacyKeyPhoneP2P: // inputPrivacyKeyPhoneP2P#db9e70d2
//	case *tg.InputPrivacyKeyForwards: // inputPrivacyKeyForwards#a4dd4c08
//	case *tg.InputPrivacyKeyProfilePhoto: // inputPrivacyKeyProfilePhoto#5719bacc
//	case *tg.InputPrivacyKeyPhoneNumber: // inputPrivacyKeyPhoneNumber#352dafa
//	case *tg.InputPrivacyKeyAddedByPhone: // inputPrivacyKeyAddedByPhone#d1219bdd
//	case *tg.InputPrivacyKeyVoiceMessages: // inputPrivacyKeyVoiceMessages#aee69d68
//	case *tg.InputPrivacyKeyAbout: // inputPrivacyKeyAbout#3823cc40
//	case *tg.InputPrivacyKeyBirthday: // inputPrivacyKeyBirthday#d65a11cc
//	case *tg.InputPrivacyKeyStarGiftsAutoSave: // inputPrivacyKeyStarGiftsAutoSave#e1732341
//	case *tg.InputPrivacyKeyNoPaidMessages: // inputPrivacyKeyNoPaidMessages#bdc597b4
//	case *tg.InputPrivacyKeySavedMusic: // inputPrivacyKeySavedMusic#4dbe9226
//	default: panic(v)
//	}
type InputPrivacyKeyClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputPrivacyKeyClass

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

// DecodeInputPrivacyKey implements binary de-serialization for InputPrivacyKeyClass.
func DecodeInputPrivacyKey(buf *bin.Buffer) (InputPrivacyKeyClass, error) {
	id, err := buf.PeekID()
	if err != nil {
		return nil, err
	}
	switch id {
	case InputPrivacyKeyStatusTimestampTypeID:
		// Decoding inputPrivacyKeyStatusTimestamp#4f96cb18.
		v := InputPrivacyKeyStatusTimestamp{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyChatInviteTypeID:
		// Decoding inputPrivacyKeyChatInvite#bdfb0426.
		v := InputPrivacyKeyChatInvite{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyPhoneCallTypeID:
		// Decoding inputPrivacyKeyPhoneCall#fabadc5f.
		v := InputPrivacyKeyPhoneCall{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyPhoneP2PTypeID:
		// Decoding inputPrivacyKeyPhoneP2P#db9e70d2.
		v := InputPrivacyKeyPhoneP2P{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyForwardsTypeID:
		// Decoding inputPrivacyKeyForwards#a4dd4c08.
		v := InputPrivacyKeyForwards{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyProfilePhotoTypeID:
		// Decoding inputPrivacyKeyProfilePhoto#5719bacc.
		v := InputPrivacyKeyProfilePhoto{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyPhoneNumberTypeID:
		// Decoding inputPrivacyKeyPhoneNumber#352dafa.
		v := InputPrivacyKeyPhoneNumber{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyAddedByPhoneTypeID:
		// Decoding inputPrivacyKeyAddedByPhone#d1219bdd.
		v := InputPrivacyKeyAddedByPhone{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyVoiceMessagesTypeID:
		// Decoding inputPrivacyKeyVoiceMessages#aee69d68.
		v := InputPrivacyKeyVoiceMessages{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyAboutTypeID:
		// Decoding inputPrivacyKeyAbout#3823cc40.
		v := InputPrivacyKeyAbout{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyBirthdayTypeID:
		// Decoding inputPrivacyKeyBirthday#d65a11cc.
		v := InputPrivacyKeyBirthday{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyStarGiftsAutoSaveTypeID:
		// Decoding inputPrivacyKeyStarGiftsAutoSave#e1732341.
		v := InputPrivacyKeyStarGiftsAutoSave{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeyNoPaidMessagesTypeID:
		// Decoding inputPrivacyKeyNoPaidMessages#bdc597b4.
		v := InputPrivacyKeyNoPaidMessages{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	case InputPrivacyKeySavedMusicTypeID:
		// Decoding inputPrivacyKeySavedMusic#4dbe9226.
		v := InputPrivacyKeySavedMusic{}
		if err := v.Decode(buf); err != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", err)
		}
		return &v, nil
	default:
		return nil, fmt.Errorf("unable to decode InputPrivacyKeyClass: %w", bin.NewUnexpectedID(id))
	}
}

// InputPrivacyKey boxes the InputPrivacyKeyClass providing a helper.
type InputPrivacyKeyBox struct {
	InputPrivacyKey InputPrivacyKeyClass
}

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

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