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

// PrivacyValueAllowContacts represents TL type `privacyValueAllowContacts#fffe1bac`.
// Allow all contacts
//
// See https://core.telegram.org/constructor/privacyValueAllowContacts for reference.
type PrivacyValueAllowContacts struct {
}

// PrivacyValueAllowContactsTypeID is TL type id of PrivacyValueAllowContacts.
const PrivacyValueAllowContactsTypeID = 0xfffe1bac

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueAllowContacts) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueAllowContacts{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueAllowContacts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueAllowContacts#fffe1bac as nil")
	}
	.PutID(PrivacyValueAllowContactsTypeID)
	return .EncodeBare()
}

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

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

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

// PrivacyValueAllowAll represents TL type `privacyValueAllowAll#65427b82`.
// Allow all users
//
// See https://core.telegram.org/constructor/privacyValueAllowAll for reference.
type PrivacyValueAllowAll struct {
}

// PrivacyValueAllowAllTypeID is TL type id of PrivacyValueAllowAll.
const PrivacyValueAllowAllTypeID = 0x65427b82

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueAllowAll) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueAllowAll{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueAllowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueAllowAll#65427b82 as nil")
	}
	.PutID(PrivacyValueAllowAllTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PrivacyValueAllowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueAllowAll#65427b82 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PrivacyValueAllowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode privacyValueAllowAll#65427b82 to nil")
	}
	return nil
}

// PrivacyValueAllowUsers represents TL type `privacyValueAllowUsers#b8905fb2`.
// Allow only certain users
//
// See https://core.telegram.org/constructor/privacyValueAllowUsers for reference.
type PrivacyValueAllowUsers struct {
	// Allowed users
	Users []int64
}

// PrivacyValueAllowUsersTypeID is TL type id of PrivacyValueAllowUsers.
const PrivacyValueAllowUsersTypeID = 0xb8905fb2

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueAllowUsers) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueAllowUsers{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueAllowUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueAllowUsers#b8905fb2 as nil")
	}
	.PutID(PrivacyValueAllowUsersTypeID)
	return .EncodeBare()
}

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

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

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

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

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

// PrivacyValueDisallowContacts represents TL type `privacyValueDisallowContacts#f888fa1a`.
// Disallow only contacts
//
// See https://core.telegram.org/constructor/privacyValueDisallowContacts for reference.
type PrivacyValueDisallowContacts struct {
}

// PrivacyValueDisallowContactsTypeID is TL type id of PrivacyValueDisallowContacts.
const PrivacyValueDisallowContactsTypeID = 0xf888fa1a

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueDisallowContacts) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueDisallowContacts{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueDisallowContacts) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueDisallowContacts#f888fa1a as nil")
	}
	.PutID(PrivacyValueDisallowContactsTypeID)
	return .EncodeBare()
}

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

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

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

// PrivacyValueDisallowAll represents TL type `privacyValueDisallowAll#8b73e763`.
// Disallow all users
//
// See https://core.telegram.org/constructor/privacyValueDisallowAll for reference.
type PrivacyValueDisallowAll struct {
}

// PrivacyValueDisallowAllTypeID is TL type id of PrivacyValueDisallowAll.
const PrivacyValueDisallowAllTypeID = 0x8b73e763

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueDisallowAll) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueDisallowAll{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueDisallowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueDisallowAll#8b73e763 as nil")
	}
	.PutID(PrivacyValueDisallowAllTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PrivacyValueDisallowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueDisallowAll#8b73e763 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PrivacyValueDisallowAll) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode privacyValueDisallowAll#8b73e763 to nil")
	}
	return nil
}

// PrivacyValueDisallowUsers represents TL type `privacyValueDisallowUsers#e4621141`.
// Disallow only certain users
//
// See https://core.telegram.org/constructor/privacyValueDisallowUsers for reference.
type PrivacyValueDisallowUsers struct {
	// Disallowed users
	Users []int64
}

// PrivacyValueDisallowUsersTypeID is TL type id of PrivacyValueDisallowUsers.
const PrivacyValueDisallowUsersTypeID = 0xe4621141

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueDisallowUsers) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueDisallowUsers{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueDisallowUsers) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueDisallowUsers#e4621141 as nil")
	}
	.PutID(PrivacyValueDisallowUsersTypeID)
	return .EncodeBare()
}

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

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

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

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

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

// PrivacyValueAllowChatParticipants represents TL type `privacyValueAllowChatParticipants#6b134e8e`.
// Allow all participants of certain chats
//
// See https://core.telegram.org/constructor/privacyValueAllowChatParticipants for reference.
type PrivacyValueAllowChatParticipants struct {
	// Allowed chats
	Chats []int64
}

// PrivacyValueAllowChatParticipantsTypeID is TL type id of PrivacyValueAllowChatParticipants.
const PrivacyValueAllowChatParticipantsTypeID = 0x6b134e8e

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueAllowChatParticipants) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueAllowChatParticipants{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueAllowChatParticipants) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueAllowChatParticipants#6b134e8e as nil")
	}
	.PutID(PrivacyValueAllowChatParticipantsTypeID)
	return .EncodeBare()
}

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

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

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

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

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

// PrivacyValueDisallowChatParticipants represents TL type `privacyValueDisallowChatParticipants#41c87565`.
// Disallow only participants of certain chats
//
// See https://core.telegram.org/constructor/privacyValueDisallowChatParticipants for reference.
type PrivacyValueDisallowChatParticipants struct {
	// Disallowed chats
	Chats []int64
}

// PrivacyValueDisallowChatParticipantsTypeID is TL type id of PrivacyValueDisallowChatParticipants.
const PrivacyValueDisallowChatParticipantsTypeID = 0x41c87565

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueDisallowChatParticipants) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueDisallowChatParticipants{}
)

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueDisallowChatParticipants) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueDisallowChatParticipants#41c87565 as nil")
	}
	.PutID(PrivacyValueDisallowChatParticipantsTypeID)
	return .EncodeBare()
}

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

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

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

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

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

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

// PrivacyValueAllowCloseFriendsTypeID is TL type id of PrivacyValueAllowCloseFriends.
const PrivacyValueAllowCloseFriendsTypeID = 0xf7e8d89b

// construct implements constructor of PrivacyRuleClass.
func ( PrivacyValueAllowCloseFriends) () PrivacyRuleClass { return & }

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

	_ PrivacyRuleClass = &PrivacyValueAllowCloseFriends{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *PrivacyValueAllowCloseFriends) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode privacyValueAllowCloseFriends#f7e8d89b as nil")
	}
	.PutID(PrivacyValueAllowCloseFriendsTypeID)
	return .EncodeBare()
}

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

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

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

// PrivacyRuleClassName is schema name of PrivacyRuleClass.
const PrivacyRuleClassName = "PrivacyRule"

// PrivacyRuleClass represents PrivacyRule generic type.
//
// See https://core.telegram.org/type/PrivacyRule for reference.
//
// Example:
//
//	g, err := tg.DecodePrivacyRule(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.PrivacyValueAllowContacts: // privacyValueAllowContacts#fffe1bac
//	case *tg.PrivacyValueAllowAll: // privacyValueAllowAll#65427b82
//	case *tg.PrivacyValueAllowUsers: // privacyValueAllowUsers#b8905fb2
//	case *tg.PrivacyValueDisallowContacts: // privacyValueDisallowContacts#f888fa1a
//	case *tg.PrivacyValueDisallowAll: // privacyValueDisallowAll#8b73e763
//	case *tg.PrivacyValueDisallowUsers: // privacyValueDisallowUsers#e4621141
//	case *tg.PrivacyValueAllowChatParticipants: // privacyValueAllowChatParticipants#6b134e8e
//	case *tg.PrivacyValueDisallowChatParticipants: // privacyValueDisallowChatParticipants#41c87565
//	case *tg.PrivacyValueAllowCloseFriends: // privacyValueAllowCloseFriends#f7e8d89b
//	default: panic(v)
//	}
type PrivacyRuleClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() PrivacyRuleClass

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

// AsInput tries to map PrivacyValueAllowChatParticipants to InputPrivacyValueAllowChatParticipants.
func ( *PrivacyValueAllowChatParticipants) () *InputPrivacyValueAllowChatParticipants {
	 := new(InputPrivacyValueAllowChatParticipants)
	.Chats = .GetChats()

	return 
}

// AsInput tries to map PrivacyValueDisallowChatParticipants to InputPrivacyValueDisallowChatParticipants.
func ( *PrivacyValueDisallowChatParticipants) () *InputPrivacyValueDisallowChatParticipants {
	 := new(InputPrivacyValueDisallowChatParticipants)
	.Chats = .GetChats()

	return 
}

// DecodePrivacyRule implements binary de-serialization for PrivacyRuleClass.
func ( *bin.Buffer) (PrivacyRuleClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case PrivacyValueAllowContactsTypeID:
		// Decoding privacyValueAllowContacts#fffe1bac.
		 := PrivacyValueAllowContacts{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	case PrivacyValueAllowAllTypeID:
		// Decoding privacyValueAllowAll#65427b82.
		 := PrivacyValueAllowAll{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	case PrivacyValueAllowUsersTypeID:
		// Decoding privacyValueAllowUsers#b8905fb2.
		 := PrivacyValueAllowUsers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	case PrivacyValueDisallowContactsTypeID:
		// Decoding privacyValueDisallowContacts#f888fa1a.
		 := PrivacyValueDisallowContacts{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	case PrivacyValueDisallowAllTypeID:
		// Decoding privacyValueDisallowAll#8b73e763.
		 := PrivacyValueDisallowAll{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	case PrivacyValueDisallowUsersTypeID:
		// Decoding privacyValueDisallowUsers#e4621141.
		 := PrivacyValueDisallowUsers{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	case PrivacyValueAllowChatParticipantsTypeID:
		// Decoding privacyValueAllowChatParticipants#6b134e8e.
		 := PrivacyValueAllowChatParticipants{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	case PrivacyValueDisallowChatParticipantsTypeID:
		// Decoding privacyValueDisallowChatParticipants#41c87565.
		 := PrivacyValueDisallowChatParticipants{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	case PrivacyValueAllowCloseFriendsTypeID:
		// Decoding privacyValueAllowCloseFriends#f7e8d89b.
		 := PrivacyValueAllowCloseFriends{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode PrivacyRuleClass: %w", bin.NewUnexpectedID())
	}
}

// PrivacyRule boxes the PrivacyRuleClass providing a helper.
type PrivacyRuleBox struct {
	PrivacyRule PrivacyRuleClass
}

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

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