// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// InputPrivacyValueAllowContacts represents TL type `inputPrivacyValueAllowContacts#d09e07b`.
// Allow only contacts
//
// See https://core.telegram.org/constructor/inputPrivacyValueAllowContacts for reference.
type InputPrivacyValueAllowContacts struct {
}

// InputPrivacyValueAllowContactsTypeID is TL type id of InputPrivacyValueAllowContacts.
const InputPrivacyValueAllowContactsTypeID = 0xd09e07b

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueAllowContacts) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueAllowContacts{}
)

func ( *InputPrivacyValueAllowContacts) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueAllowContacts) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueAllowContacts",
		ID:   InputPrivacyValueAllowContactsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueAllowContacts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowContacts#d09e07b as nil")
	}
	.PutID(InputPrivacyValueAllowContactsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueAllowContacts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowContacts#d09e07b as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueAllowContacts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueAllowContacts#d09e07b to nil")
	}
	return nil
}

// InputPrivacyValueAllowAll represents TL type `inputPrivacyValueAllowAll#184b35ce`.
// Allow all users
//
// See https://core.telegram.org/constructor/inputPrivacyValueAllowAll for reference.
type InputPrivacyValueAllowAll struct {
}

// InputPrivacyValueAllowAllTypeID is TL type id of InputPrivacyValueAllowAll.
const InputPrivacyValueAllowAllTypeID = 0x184b35ce

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueAllowAll) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueAllowAll{}
)

func ( *InputPrivacyValueAllowAll) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueAllowAll) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueAllowAll",
		ID:   InputPrivacyValueAllowAllTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueAllowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowAll#184b35ce as nil")
	}
	.PutID(InputPrivacyValueAllowAllTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueAllowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowAll#184b35ce as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueAllowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueAllowAll#184b35ce to nil")
	}
	return nil
}

// InputPrivacyValueAllowUsers represents TL type `inputPrivacyValueAllowUsers#131cc67f`.
// Allow only certain users
//
// See https://core.telegram.org/constructor/inputPrivacyValueAllowUsers for reference.
type InputPrivacyValueAllowUsers struct {
	// Allowed users
	Users []InputUserClass
}

// InputPrivacyValueAllowUsersTypeID is TL type id of InputPrivacyValueAllowUsers.
const InputPrivacyValueAllowUsersTypeID = 0x131cc67f

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueAllowUsers) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueAllowUsers{}
)

func ( *InputPrivacyValueAllowUsers) () bool {
	if  == nil {
		return true
	}
	if !(.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputPrivacyValueAllowUsers from given interface.
func ( *InputPrivacyValueAllowUsers) ( interface {
	() ( []InputUserClass)
}) {
	.Users = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueAllowUsers) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueAllowUsers",
		ID:   InputPrivacyValueAllowUsersTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueAllowUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowUsers#131cc67f as nil")
	}
	.PutID(InputPrivacyValueAllowUsersTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueAllowUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowUsers#131cc67f as nil")
	}
	.PutVectorHeader(len(.Users))
	for ,  := range .Users {
		if  == nil {
			return fmt.Errorf("unable to encode inputPrivacyValueAllowUsers#131cc67f: field users element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode inputPrivacyValueAllowUsers#131cc67f: field users element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueAllowUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueAllowUsers#131cc67f to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputPrivacyValueAllowUsers#131cc67f: field users: %w", )
		}

		if  > 0 {
			.Users = make([]InputUserClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputUser()
			if  != nil {
				return fmt.Errorf("unable to decode inputPrivacyValueAllowUsers#131cc67f: field users: %w", )
			}
			.Users = append(.Users, )
		}
	}
	return nil
}

// GetUsers returns value of Users field.
func ( *InputPrivacyValueAllowUsers) () ( []InputUserClass) {
	if  == nil {
		return
	}
	return .Users
}

// MapUsers returns field Users wrapped in InputUserClassArray helper.
func ( *InputPrivacyValueAllowUsers) () ( InputUserClassArray) {
	return InputUserClassArray(.Users)
}

// InputPrivacyValueDisallowContacts represents TL type `inputPrivacyValueDisallowContacts#ba52007`.
// Disallow only contacts
//
// See https://core.telegram.org/constructor/inputPrivacyValueDisallowContacts for reference.
type InputPrivacyValueDisallowContacts struct {
}

// InputPrivacyValueDisallowContactsTypeID is TL type id of InputPrivacyValueDisallowContacts.
const InputPrivacyValueDisallowContactsTypeID = 0xba52007

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueDisallowContacts) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueDisallowContacts{}
)

func ( *InputPrivacyValueDisallowContacts) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueDisallowContacts) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueDisallowContacts",
		ID:   InputPrivacyValueDisallowContactsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueDisallowContacts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueDisallowContacts#ba52007 as nil")
	}
	.PutID(InputPrivacyValueDisallowContactsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueDisallowContacts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueDisallowContacts#ba52007 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueDisallowContacts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueDisallowContacts#ba52007 to nil")
	}
	return nil
}

// InputPrivacyValueDisallowAll represents TL type `inputPrivacyValueDisallowAll#d66b66c9`.
// Disallow all
//
// See https://core.telegram.org/constructor/inputPrivacyValueDisallowAll for reference.
type InputPrivacyValueDisallowAll struct {
}

// InputPrivacyValueDisallowAllTypeID is TL type id of InputPrivacyValueDisallowAll.
const InputPrivacyValueDisallowAllTypeID = 0xd66b66c9

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueDisallowAll) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueDisallowAll{}
)

func ( *InputPrivacyValueDisallowAll) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueDisallowAll) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueDisallowAll",
		ID:   InputPrivacyValueDisallowAllTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueDisallowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueDisallowAll#d66b66c9 as nil")
	}
	.PutID(InputPrivacyValueDisallowAllTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueDisallowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueDisallowAll#d66b66c9 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueDisallowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueDisallowAll#d66b66c9 to nil")
	}
	return nil
}

// InputPrivacyValueDisallowUsers represents TL type `inputPrivacyValueDisallowUsers#90110467`.
// Disallow only certain users
//
// See https://core.telegram.org/constructor/inputPrivacyValueDisallowUsers for reference.
type InputPrivacyValueDisallowUsers struct {
	// Users to disallow
	Users []InputUserClass
}

// InputPrivacyValueDisallowUsersTypeID is TL type id of InputPrivacyValueDisallowUsers.
const InputPrivacyValueDisallowUsersTypeID = 0x90110467

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueDisallowUsers) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueDisallowUsers{}
)

func ( *InputPrivacyValueDisallowUsers) () bool {
	if  == nil {
		return true
	}
	if !(.Users == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputPrivacyValueDisallowUsers from given interface.
func ( *InputPrivacyValueDisallowUsers) ( interface {
	() ( []InputUserClass)
}) {
	.Users = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueDisallowUsers) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueDisallowUsers",
		ID:   InputPrivacyValueDisallowUsersTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Users",
			SchemaName: "users",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueDisallowUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueDisallowUsers#90110467 as nil")
	}
	.PutID(InputPrivacyValueDisallowUsersTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueDisallowUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueDisallowUsers#90110467 as nil")
	}
	.PutVectorHeader(len(.Users))
	for ,  := range .Users {
		if  == nil {
			return fmt.Errorf("unable to encode inputPrivacyValueDisallowUsers#90110467: field users element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode inputPrivacyValueDisallowUsers#90110467: field users element with index %d: %w", , )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueDisallowUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueDisallowUsers#90110467 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputPrivacyValueDisallowUsers#90110467: field users: %w", )
		}

		if  > 0 {
			.Users = make([]InputUserClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeInputUser()
			if  != nil {
				return fmt.Errorf("unable to decode inputPrivacyValueDisallowUsers#90110467: field users: %w", )
			}
			.Users = append(.Users, )
		}
	}
	return nil
}

// GetUsers returns value of Users field.
func ( *InputPrivacyValueDisallowUsers) () ( []InputUserClass) {
	if  == nil {
		return
	}
	return .Users
}

// MapUsers returns field Users wrapped in InputUserClassArray helper.
func ( *InputPrivacyValueDisallowUsers) () ( InputUserClassArray) {
	return InputUserClassArray(.Users)
}

// InputPrivacyValueAllowChatParticipants represents TL type `inputPrivacyValueAllowChatParticipants#840649cf`.
// Allow only participants of certain chats
//
// See https://core.telegram.org/constructor/inputPrivacyValueAllowChatParticipants for reference.
type InputPrivacyValueAllowChatParticipants struct {
	// Allowed chat IDs
	Chats []int64
}

// InputPrivacyValueAllowChatParticipantsTypeID is TL type id of InputPrivacyValueAllowChatParticipants.
const InputPrivacyValueAllowChatParticipantsTypeID = 0x840649cf

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueAllowChatParticipants) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueAllowChatParticipants{}
)

func ( *InputPrivacyValueAllowChatParticipants) () bool {
	if  == nil {
		return true
	}
	if !(.Chats == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputPrivacyValueAllowChatParticipants from given interface.
func ( *InputPrivacyValueAllowChatParticipants) ( interface {
	() ( []int64)
}) {
	.Chats = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueAllowChatParticipants) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueAllowChatParticipants",
		ID:   InputPrivacyValueAllowChatParticipantsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Chats",
			SchemaName: "chats",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueAllowChatParticipants) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowChatParticipants#840649cf as nil")
	}
	.PutID(InputPrivacyValueAllowChatParticipantsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueAllowChatParticipants) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowChatParticipants#840649cf as nil")
	}
	.PutVectorHeader(len(.Chats))
	for ,  := range .Chats {
		.PutLong()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueAllowChatParticipants) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueAllowChatParticipants#840649cf to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputPrivacyValueAllowChatParticipants#840649cf: field chats: %w", )
		}

		if  > 0 {
			.Chats = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode inputPrivacyValueAllowChatParticipants#840649cf: field chats: %w", )
			}
			.Chats = append(.Chats, )
		}
	}
	return nil
}

// GetChats returns value of Chats field.
func ( *InputPrivacyValueAllowChatParticipants) () ( []int64) {
	if  == nil {
		return
	}
	return .Chats
}

// InputPrivacyValueDisallowChatParticipants represents TL type `inputPrivacyValueDisallowChatParticipants#e94f0f86`.
// Disallow only participants of certain chats
//
// See https://core.telegram.org/constructor/inputPrivacyValueDisallowChatParticipants for reference.
type InputPrivacyValueDisallowChatParticipants struct {
	// Disallowed chat IDs
	Chats []int64
}

// InputPrivacyValueDisallowChatParticipantsTypeID is TL type id of InputPrivacyValueDisallowChatParticipants.
const InputPrivacyValueDisallowChatParticipantsTypeID = 0xe94f0f86

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueDisallowChatParticipants) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueDisallowChatParticipants{}
)

func ( *InputPrivacyValueDisallowChatParticipants) () bool {
	if  == nil {
		return true
	}
	if !(.Chats == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputPrivacyValueDisallowChatParticipants from given interface.
func ( *InputPrivacyValueDisallowChatParticipants) ( interface {
	() ( []int64)
}) {
	.Chats = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueDisallowChatParticipants) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueDisallowChatParticipants",
		ID:   InputPrivacyValueDisallowChatParticipantsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Chats",
			SchemaName: "chats",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueDisallowChatParticipants) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueDisallowChatParticipants#e94f0f86 as nil")
	}
	.PutID(InputPrivacyValueDisallowChatParticipantsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueDisallowChatParticipants) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueDisallowChatParticipants#e94f0f86 as nil")
	}
	.PutVectorHeader(len(.Chats))
	for ,  := range .Chats {
		.PutLong()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueDisallowChatParticipants) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueDisallowChatParticipants#e94f0f86 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode inputPrivacyValueDisallowChatParticipants#e94f0f86: field chats: %w", )
		}

		if  > 0 {
			.Chats = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode inputPrivacyValueDisallowChatParticipants#e94f0f86: field chats: %w", )
			}
			.Chats = append(.Chats, )
		}
	}
	return nil
}

// GetChats returns value of Chats field.
func ( *InputPrivacyValueDisallowChatParticipants) () ( []int64) {
	if  == nil {
		return
	}
	return .Chats
}

// InputPrivacyValueAllowCloseFriends represents TL type `inputPrivacyValueAllowCloseFriends#2f453e49`.
// Allow only close friends »¹
//
// Links:
//  1. https://core.telegram.org/api/privacy
//
// See https://core.telegram.org/constructor/inputPrivacyValueAllowCloseFriends for reference.
type InputPrivacyValueAllowCloseFriends struct {
}

// InputPrivacyValueAllowCloseFriendsTypeID is TL type id of InputPrivacyValueAllowCloseFriends.
const InputPrivacyValueAllowCloseFriendsTypeID = 0x2f453e49

// construct implements constructor of InputPrivacyRuleClass.
func ( InputPrivacyValueAllowCloseFriends) () InputPrivacyRuleClass { return & }

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

	_ InputPrivacyRuleClass = &InputPrivacyValueAllowCloseFriends{}
)

func ( *InputPrivacyValueAllowCloseFriends) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *InputPrivacyValueAllowCloseFriends) () tdp.Type {
	 := tdp.Type{
		Name: "inputPrivacyValueAllowCloseFriends",
		ID:   InputPrivacyValueAllowCloseFriendsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPrivacyValueAllowCloseFriends) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowCloseFriends#2f453e49 as nil")
	}
	.PutID(InputPrivacyValueAllowCloseFriendsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPrivacyValueAllowCloseFriends) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPrivacyValueAllowCloseFriends#2f453e49 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPrivacyValueAllowCloseFriends) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPrivacyValueAllowCloseFriends#2f453e49 to nil")
	}
	return nil
}

// InputPrivacyRuleClassName is schema name of InputPrivacyRuleClass.
const InputPrivacyRuleClassName = "InputPrivacyRule"

// InputPrivacyRuleClass represents InputPrivacyRule generic type.
//
// See https://core.telegram.org/type/InputPrivacyRule for reference.
//
// Example:
//
//	g, err := tg.DecodeInputPrivacyRule(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputPrivacyValueAllowContacts: // inputPrivacyValueAllowContacts#d09e07b
//	case *tg.InputPrivacyValueAllowAll: // inputPrivacyValueAllowAll#184b35ce
//	case *tg.InputPrivacyValueAllowUsers: // inputPrivacyValueAllowUsers#131cc67f
//	case *tg.InputPrivacyValueDisallowContacts: // inputPrivacyValueDisallowContacts#ba52007
//	case *tg.InputPrivacyValueDisallowAll: // inputPrivacyValueDisallowAll#d66b66c9
//	case *tg.InputPrivacyValueDisallowUsers: // inputPrivacyValueDisallowUsers#90110467
//	case *tg.InputPrivacyValueAllowChatParticipants: // inputPrivacyValueAllowChatParticipants#840649cf
//	case *tg.InputPrivacyValueDisallowChatParticipants: // inputPrivacyValueDisallowChatParticipants#e94f0f86
//	case *tg.InputPrivacyValueAllowCloseFriends: // inputPrivacyValueAllowCloseFriends#2f453e49
//	default: panic(v)
//	}
type InputPrivacyRuleClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputPrivacyRuleClass

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

// DecodeInputPrivacyRule implements binary de-serialization for InputPrivacyRuleClass.
func ( *bin.Buffer) (InputPrivacyRuleClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputPrivacyValueAllowContactsTypeID:
		// Decoding inputPrivacyValueAllowContacts#d09e07b.
		 := InputPrivacyValueAllowContacts{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	case InputPrivacyValueAllowAllTypeID:
		// Decoding inputPrivacyValueAllowAll#184b35ce.
		 := InputPrivacyValueAllowAll{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	case InputPrivacyValueAllowUsersTypeID:
		// Decoding inputPrivacyValueAllowUsers#131cc67f.
		 := InputPrivacyValueAllowUsers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	case InputPrivacyValueDisallowContactsTypeID:
		// Decoding inputPrivacyValueDisallowContacts#ba52007.
		 := InputPrivacyValueDisallowContacts{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	case InputPrivacyValueDisallowAllTypeID:
		// Decoding inputPrivacyValueDisallowAll#d66b66c9.
		 := InputPrivacyValueDisallowAll{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	case InputPrivacyValueDisallowUsersTypeID:
		// Decoding inputPrivacyValueDisallowUsers#90110467.
		 := InputPrivacyValueDisallowUsers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	case InputPrivacyValueAllowChatParticipantsTypeID:
		// Decoding inputPrivacyValueAllowChatParticipants#840649cf.
		 := InputPrivacyValueAllowChatParticipants{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	case InputPrivacyValueDisallowChatParticipantsTypeID:
		// Decoding inputPrivacyValueDisallowChatParticipants#e94f0f86.
		 := InputPrivacyValueDisallowChatParticipants{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	case InputPrivacyValueAllowCloseFriendsTypeID:
		// Decoding inputPrivacyValueAllowCloseFriends#2f453e49.
		 := InputPrivacyValueAllowCloseFriends{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputPrivacyRuleClass: %w", bin.NewUnexpectedID())
	}
}

// InputPrivacyRule boxes the InputPrivacyRuleClass providing a helper.
type InputPrivacyRuleBox struct {
	InputPrivacyRule InputPrivacyRuleClass
}

// Decode implements bin.Decoder for InputPrivacyRuleBox.
func ( *InputPrivacyRuleBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode InputPrivacyRuleBox to nil")
	}
	,  := DecodeInputPrivacyRule()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.InputPrivacyRule = 
	return nil
}

// Encode implements bin.Encode for InputPrivacyRuleBox.
func ( *InputPrivacyRuleBox) ( *bin.Buffer) error {
	if  == nil || .InputPrivacyRule == nil {
		return fmt.Errorf("unable to encode InputPrivacyRuleClass as nil")
	}
	return .InputPrivacyRule.Encode()
}