// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.27.1
// 	protoc        v3.17.3
// source: api_proto/kill_switch_objects.proto

package api_proto

import (
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
	reflect "reflect"
	sync "sync"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

type Feature_Type int32

const (
	Feature_TYPE_UNKNOWN    Feature_Type = 0
	Feature_TYPE_EXPERIMENT Feature_Type = 1
	Feature_TYPE_OPTION     Feature_Type = 2
	Feature_TYPE_DEPRECATED Feature_Type = 10
)

// Enum value maps for Feature_Type.
var (
	Feature_Type_name = map[int32]string{
		0:  "TYPE_UNKNOWN",
		1:  "TYPE_EXPERIMENT",
		2:  "TYPE_OPTION",
		10: "TYPE_DEPRECATED",
	}
	Feature_Type_value = map[string]int32{
		"TYPE_UNKNOWN":    0,
		"TYPE_EXPERIMENT": 1,
		"TYPE_OPTION":     2,
		"TYPE_DEPRECATED": 10,
	}
)

func (x Feature_Type) Enum() *Feature_Type {
	p := new(Feature_Type)
	*p = x
	return p
}

func (x Feature_Type) String() string {
	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}

func (Feature_Type) Descriptor() protoreflect.EnumDescriptor {
	return file_api_proto_kill_switch_objects_proto_enumTypes[0].Descriptor()
}

func (Feature_Type) Type() protoreflect.EnumType {
	return &file_api_proto_kill_switch_objects_proto_enumTypes[0]
}

func (x Feature_Type) Number() protoreflect.EnumNumber {
	return protoreflect.EnumNumber(x)
}

// Deprecated: Use Feature_Type.Descriptor instead.
func (Feature_Type) EnumDescriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{0, 0}
}

type KillSwitchAuthorizedUser_AccessLevel int32

const (
	KillSwitchAuthorizedUser_ACCESS_LEVEL_NONE      KillSwitchAuthorizedUser_AccessLevel = 0
	KillSwitchAuthorizedUser_ACCESS_LEVEL_ACTIVATOR KillSwitchAuthorizedUser_AccessLevel = 1 // The user may enable/disable kill switches.
	KillSwitchAuthorizedUser_ACCESS_LEVEL_ADMIN     KillSwitchAuthorizedUser_AccessLevel = 2 // The user may perform any action.
)

// Enum value maps for KillSwitchAuthorizedUser_AccessLevel.
var (
	KillSwitchAuthorizedUser_AccessLevel_name = map[int32]string{
		0: "ACCESS_LEVEL_NONE",
		1: "ACCESS_LEVEL_ACTIVATOR",
		2: "ACCESS_LEVEL_ADMIN",
	}
	KillSwitchAuthorizedUser_AccessLevel_value = map[string]int32{
		"ACCESS_LEVEL_NONE":      0,
		"ACCESS_LEVEL_ACTIVATOR": 1,
		"ACCESS_LEVEL_ADMIN":     2,
	}
)

func (x KillSwitchAuthorizedUser_AccessLevel) Enum() *KillSwitchAuthorizedUser_AccessLevel {
	p := new(KillSwitchAuthorizedUser_AccessLevel)
	*p = x
	return p
}

func (x KillSwitchAuthorizedUser_AccessLevel) String() string {
	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}

func (KillSwitchAuthorizedUser_AccessLevel) Descriptor() protoreflect.EnumDescriptor {
	return file_api_proto_kill_switch_objects_proto_enumTypes[1].Descriptor()
}

func (KillSwitchAuthorizedUser_AccessLevel) Type() protoreflect.EnumType {
	return &file_api_proto_kill_switch_objects_proto_enumTypes[1]
}

func (x KillSwitchAuthorizedUser_AccessLevel) Number() protoreflect.EnumNumber {
	return protoreflect.EnumNumber(x)
}

// Deprecated: Use KillSwitchAuthorizedUser_AccessLevel.Descriptor instead.
func (KillSwitchAuthorizedUser_AccessLevel) EnumDescriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{2, 0}
}

type Feature struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Id       int32        `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Codename string       `protobuf:"bytes,2,opt,name=codename,proto3" json:"codename,omitempty"`
	Type     Feature_Type `protobuf:"varint,3,opt,name=type,proto3,enum=Feature_Type" json:"type,omitempty"`
}

func (x *Feature) Reset() {
	*x = Feature{}
	if protoimpl.UnsafeEnabled {
		mi := &file_api_proto_kill_switch_objects_proto_msgTypes[0]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *Feature) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Feature) ProtoMessage() {}

func (x *Feature) ProtoReflect() protoreflect.Message {
	mi := &file_api_proto_kill_switch_objects_proto_msgTypes[0]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Feature.ProtoReflect.Descriptor instead.
func (*Feature) Descriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{0}
}

func (x *Feature) GetId() int32 {
	if x != nil {
		return x.Id
	}
	return 0
}

func (x *Feature) GetCodename() string {
	if x != nil {
		return x.Codename
	}
	return ""
}

func (x *Feature) GetType() Feature_Type {
	if x != nil {
		return x.Type
	}
	return Feature_TYPE_UNKNOWN
}

type KillSwitch struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Id         int32                 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Feature    *Feature              `protobuf:"bytes,2,opt,name=feature,proto3" json:"feature,omitempty"`
	MinVersion string                `protobuf:"bytes,3,opt,name=min_version,json=minVersion,proto3" json:"min_version,omitempty"`
	MaxVersion string                `protobuf:"bytes,4,opt,name=max_version,json=maxVersion,proto3" json:"max_version,omitempty"`
	Browsers   []Environment_Browser `protobuf:"varint,5,rep,packed,name=browsers,proto3,enum=Environment_Browser" json:"browsers,omitempty"`
	Active     bool                  `protobuf:"varint,6,opt,name=active,proto3" json:"active,omitempty"`
}

func (x *KillSwitch) Reset() {
	*x = KillSwitch{}
	if protoimpl.UnsafeEnabled {
		mi := &file_api_proto_kill_switch_objects_proto_msgTypes[1]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *KillSwitch) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*KillSwitch) ProtoMessage() {}

func (x *KillSwitch) ProtoReflect() protoreflect.Message {
	mi := &file_api_proto_kill_switch_objects_proto_msgTypes[1]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use KillSwitch.ProtoReflect.Descriptor instead.
func (*KillSwitch) Descriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{1}
}

func (x *KillSwitch) GetId() int32 {
	if x != nil {
		return x.Id
	}
	return 0
}

func (x *KillSwitch) GetFeature() *Feature {
	if x != nil {
		return x.Feature
	}
	return nil
}

func (x *KillSwitch) GetMinVersion() string {
	if x != nil {
		return x.MinVersion
	}
	return ""
}

func (x *KillSwitch) GetMaxVersion() string {
	if x != nil {
		return x.MaxVersion
	}
	return ""
}

func (x *KillSwitch) GetBrowsers() []Environment_Browser {
	if x != nil {
		return x.Browsers
	}
	return nil
}

func (x *KillSwitch) GetActive() bool {
	if x != nil {
		return x.Active
	}
	return false
}

type KillSwitchAuthorizedUser struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Id          int32                                `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	GoogleUid   string                               `protobuf:"bytes,2,opt,name=google_uid,json=googleUid,proto3" json:"google_uid,omitempty"`
	Email       string                               `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	AccessLevel KillSwitchAuthorizedUser_AccessLevel `protobuf:"varint,4,opt,name=access_level,json=accessLevel,proto3,enum=KillSwitchAuthorizedUser_AccessLevel" json:"access_level,omitempty"`
}

func (x *KillSwitchAuthorizedUser) Reset() {
	*x = KillSwitchAuthorizedUser{}
	if protoimpl.UnsafeEnabled {
		mi := &file_api_proto_kill_switch_objects_proto_msgTypes[2]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *KillSwitchAuthorizedUser) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*KillSwitchAuthorizedUser) ProtoMessage() {}

func (x *KillSwitchAuthorizedUser) ProtoReflect() protoreflect.Message {
	mi := &file_api_proto_kill_switch_objects_proto_msgTypes[2]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use KillSwitchAuthorizedUser.ProtoReflect.Descriptor instead.
func (*KillSwitchAuthorizedUser) Descriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{2}
}

func (x *KillSwitchAuthorizedUser) GetId() int32 {
	if x != nil {
		return x.Id
	}
	return 0
}

func (x *KillSwitchAuthorizedUser) GetGoogleUid() string {
	if x != nil {
		return x.GoogleUid
	}
	return ""
}

func (x *KillSwitchAuthorizedUser) GetEmail() string {
	if x != nil {
		return x.Email
	}
	return ""
}

func (x *KillSwitchAuthorizedUser) GetAccessLevel() KillSwitchAuthorizedUser_AccessLevel {
	if x != nil {
		return x.AccessLevel
	}
	return KillSwitchAuthorizedUser_ACCESS_LEVEL_NONE
}

type KillSwitchTransformation struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	KillSwitchFrom *KillSwitch `protobuf:"bytes,1,opt,name=kill_switch_from,json=killSwitchFrom,proto3" json:"kill_switch_from,omitempty"`
	KillSwitchTo   *KillSwitch `protobuf:"bytes,2,opt,name=kill_switch_to,json=killSwitchTo,proto3" json:"kill_switch_to,omitempty"`
}

func (x *KillSwitchTransformation) Reset() {
	*x = KillSwitchTransformation{}
	if protoimpl.UnsafeEnabled {
		mi := &file_api_proto_kill_switch_objects_proto_msgTypes[3]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *KillSwitchTransformation) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*KillSwitchTransformation) ProtoMessage() {}

func (x *KillSwitchTransformation) ProtoReflect() protoreflect.Message {
	mi := &file_api_proto_kill_switch_objects_proto_msgTypes[3]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use KillSwitchTransformation.ProtoReflect.Descriptor instead.
func (*KillSwitchTransformation) Descriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{3}
}

func (x *KillSwitchTransformation) GetKillSwitchFrom() *KillSwitch {
	if x != nil {
		return x.KillSwitchFrom
	}
	return nil
}

func (x *KillSwitchTransformation) GetKillSwitchTo() *KillSwitch {
	if x != nil {
		return x.KillSwitchTo
	}
	return nil
}

// Log entry which describes an action which has taken place.
type KillSwitchAuditLogEntry struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	// Timestamp in which the action was taken.
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// User who/which performed the action.
	User *KillSwitchAuthorizedUser `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	// Description of the action taken
	//
	// Types that are assignable to Description:
	//	*KillSwitchAuditLogEntry_KillSwitchEnabled_
	//	*KillSwitchAuditLogEntry_KillSwitchDisabled_
	Description isKillSwitchAuditLogEntry_Description `protobuf_oneof:"description"`
}

func (x *KillSwitchAuditLogEntry) Reset() {
	*x = KillSwitchAuditLogEntry{}
	if protoimpl.UnsafeEnabled {
		mi := &file_api_proto_kill_switch_objects_proto_msgTypes[4]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *KillSwitchAuditLogEntry) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*KillSwitchAuditLogEntry) ProtoMessage() {}

func (x *KillSwitchAuditLogEntry) ProtoReflect() protoreflect.Message {
	mi := &file_api_proto_kill_switch_objects_proto_msgTypes[4]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use KillSwitchAuditLogEntry.ProtoReflect.Descriptor instead.
func (*KillSwitchAuditLogEntry) Descriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{4}
}

func (x *KillSwitchAuditLogEntry) GetTimestamp() *timestamppb.Timestamp {
	if x != nil {
		return x.Timestamp
	}
	return nil
}

func (x *KillSwitchAuditLogEntry) GetUser() *KillSwitchAuthorizedUser {
	if x != nil {
		return x.User
	}
	return nil
}

func (m *KillSwitchAuditLogEntry) GetDescription() isKillSwitchAuditLogEntry_Description {
	if m != nil {
		return m.Description
	}
	return nil
}

func (x *KillSwitchAuditLogEntry) GetKillSwitchEnabled() *KillSwitchAuditLogEntry_KillSwitchEnabled {
	if x, ok := x.GetDescription().(*KillSwitchAuditLogEntry_KillSwitchEnabled_); ok {
		return x.KillSwitchEnabled
	}
	return nil
}

func (x *KillSwitchAuditLogEntry) GetKillSwitchDisabled() *KillSwitchAuditLogEntry_KillSwitchDisabled {
	if x, ok := x.GetDescription().(*KillSwitchAuditLogEntry_KillSwitchDisabled_); ok {
		return x.KillSwitchDisabled
	}
	return nil
}

type isKillSwitchAuditLogEntry_Description interface {
	isKillSwitchAuditLogEntry_Description()
}

type KillSwitchAuditLogEntry_KillSwitchEnabled_ struct {
	KillSwitchEnabled *KillSwitchAuditLogEntry_KillSwitchEnabled `protobuf:"bytes,3,opt,name=kill_switch_enabled,json=killSwitchEnabled,proto3,oneof"`
}

type KillSwitchAuditLogEntry_KillSwitchDisabled_ struct {
	KillSwitchDisabled *KillSwitchAuditLogEntry_KillSwitchDisabled `protobuf:"bytes,4,opt,name=kill_switch_disabled,json=killSwitchDisabled,proto3,oneof"`
}

func (*KillSwitchAuditLogEntry_KillSwitchEnabled_) isKillSwitchAuditLogEntry_Description() {}

func (*KillSwitchAuditLogEntry_KillSwitchDisabled_) isKillSwitchAuditLogEntry_Description() {}

type KillSwitchAuditLogEntry_KillSwitchEnabled struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Transformation *KillSwitchTransformation `protobuf:"bytes,1,opt,name=transformation,proto3" json:"transformation,omitempty"`
}

func (x *KillSwitchAuditLogEntry_KillSwitchEnabled) Reset() {
	*x = KillSwitchAuditLogEntry_KillSwitchEnabled{}
	if protoimpl.UnsafeEnabled {
		mi := &file_api_proto_kill_switch_objects_proto_msgTypes[5]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *KillSwitchAuditLogEntry_KillSwitchEnabled) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*KillSwitchAuditLogEntry_KillSwitchEnabled) ProtoMessage() {}

func (x *KillSwitchAuditLogEntry_KillSwitchEnabled) ProtoReflect() protoreflect.Message {
	mi := &file_api_proto_kill_switch_objects_proto_msgTypes[5]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use KillSwitchAuditLogEntry_KillSwitchEnabled.ProtoReflect.Descriptor instead.
func (*KillSwitchAuditLogEntry_KillSwitchEnabled) Descriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{4, 0}
}

func (x *KillSwitchAuditLogEntry_KillSwitchEnabled) GetTransformation() *KillSwitchTransformation {
	if x != nil {
		return x.Transformation
	}
	return nil
}

type KillSwitchAuditLogEntry_KillSwitchDisabled struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Transformation *KillSwitchTransformation `protobuf:"bytes,1,opt,name=transformation,proto3" json:"transformation,omitempty"`
}

func (x *KillSwitchAuditLogEntry_KillSwitchDisabled) Reset() {
	*x = KillSwitchAuditLogEntry_KillSwitchDisabled{}
	if protoimpl.UnsafeEnabled {
		mi := &file_api_proto_kill_switch_objects_proto_msgTypes[6]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *KillSwitchAuditLogEntry_KillSwitchDisabled) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*KillSwitchAuditLogEntry_KillSwitchDisabled) ProtoMessage() {}

func (x *KillSwitchAuditLogEntry_KillSwitchDisabled) ProtoReflect() protoreflect.Message {
	mi := &file_api_proto_kill_switch_objects_proto_msgTypes[6]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use KillSwitchAuditLogEntry_KillSwitchDisabled.ProtoReflect.Descriptor instead.
func (*KillSwitchAuditLogEntry_KillSwitchDisabled) Descriptor() ([]byte, []int) {
	return file_api_proto_kill_switch_objects_proto_rawDescGZIP(), []int{4, 1}
}

func (x *KillSwitchAuditLogEntry_KillSwitchDisabled) GetTransformation() *KillSwitchTransformation {
	if x != nil {
		return x.Transformation
	}
	return nil
}

var File_api_proto_kill_switch_objects_proto protoreflect.FileDescriptor

var file_api_proto_kill_switch_objects_proto_rawDesc = []byte{
	0x0a, 0x23, 0x61, 0x70, 0x69, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x69, 0x6c, 0x6c,
	0x5f, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2e,
	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x70, 0x69, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
	0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67,
	0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74,
	0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xad,
	0x01, 0x0a, 0x07, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
	0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f,
	0x64, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f,
	0x64, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03,
	0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x54,
	0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x53, 0x0a, 0x04, 0x54, 0x79, 0x70,
	0x65, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57,
	0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x50, 0x45,
	0x52, 0x49, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45,
	0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x59, 0x50,
	0x45, 0x5f, 0x44, 0x45, 0x50, 0x52, 0x45, 0x43, 0x41, 0x54, 0x45, 0x44, 0x10, 0x0a, 0x22, 0xcc,
	0x01, 0x0a, 0x0a, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x0e, 0x0a,
	0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a,
	0x07, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08,
	0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x07, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72,
	0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x69, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
	0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69,
	0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
	0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x56, 0x65, 0x72, 0x73,
	0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x08, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x73, 0x18,
	0x05, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
	0x65, 0x6e, 0x74, 0x2e, 0x42, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x52, 0x08, 0x62, 0x72, 0x6f,
	0x77, 0x73, 0x65, 0x72, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
	0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x83, 0x02,
	0x0a, 0x18, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x68,
	0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
	0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f,
	0x6f, 0x67, 0x6c, 0x65, 0x5f, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
	0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x55, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61,
	0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12,
	0x48, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18,
	0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74,
	0x63, 0x68, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72,
	0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x0b, 0x61, 0x63,
	0x63, 0x65, 0x73, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x58, 0x0a, 0x0b, 0x41, 0x63, 0x63,
	0x65, 0x73, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x43, 0x43, 0x45,
	0x53, 0x53, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12,
	0x1a, 0x0a, 0x16, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f,
	0x41, 0x43, 0x54, 0x49, 0x56, 0x41, 0x54, 0x4f, 0x52, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x41,
	0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x41, 0x44, 0x4d, 0x49,
	0x4e, 0x10, 0x02, 0x22, 0x84, 0x01, 0x0a, 0x18, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74,
	0x63, 0x68, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e,
	0x12, 0x35, 0x0a, 0x10, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x5f,
	0x66, 0x72, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x4b, 0x69, 0x6c,
	0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x52, 0x0e, 0x6b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69,
	0x74, 0x63, 0x68, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x31, 0x0a, 0x0e, 0x6b, 0x69, 0x6c, 0x6c, 0x5f,
	0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
	0x0b, 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x52, 0x0c, 0x6b, 0x69,
	0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x54, 0x6f, 0x22, 0x81, 0x04, 0x0a, 0x17, 0x4b,
	0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f,
	0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
	0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
	0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65,
	0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
	0x12, 0x2d, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
	0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x68, 0x6f,
	0x72, 0x69, 0x7a, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12,
	0x5c, 0x0a, 0x13, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x5f, 0x65,
	0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x4b,
	0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f,
	0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63,
	0x68, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x00, 0x52, 0x11, 0x6b, 0x69, 0x6c, 0x6c,
	0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x5f, 0x0a,
	0x14, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x69, 0x73,
	0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x4b, 0x69,
	0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67,
	0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
	0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x00, 0x52, 0x12, 0x6b, 0x69, 0x6c, 0x6c,
	0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x1a, 0x56,
	0x0a, 0x11, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x45, 0x6e, 0x61, 0x62,
	0x6c, 0x65, 0x64, 0x12, 0x41, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d,
	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x4b, 0x69,
	0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72,
	0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72,
	0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x57, 0x0a, 0x12, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77,
	0x69, 0x74, 0x63, 0x68, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x41, 0x0a, 0x0e,
	0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01,
	0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x4b, 0x69, 0x6c, 0x6c, 0x53, 0x77, 0x69, 0x74, 0x63,
	0x68, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
	0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42,
	0x0d, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x2e,
	0x5a, 0x2c, 0x67, 0x6f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x2e, 0x61, 0x76, 0x6d, 0x39,
	0x39, 0x39, 0x36, 0x33, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x77, 0x70, 0x74, 0x2d, 0x73, 0x65,
	0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

var (
	file_api_proto_kill_switch_objects_proto_rawDescOnce sync.Once
	file_api_proto_kill_switch_objects_proto_rawDescData = file_api_proto_kill_switch_objects_proto_rawDesc
)

func file_api_proto_kill_switch_objects_proto_rawDescGZIP() []byte {
	file_api_proto_kill_switch_objects_proto_rawDescOnce.Do(func() {
		file_api_proto_kill_switch_objects_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_proto_kill_switch_objects_proto_rawDescData)
	})
	return file_api_proto_kill_switch_objects_proto_rawDescData
}

var file_api_proto_kill_switch_objects_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_api_proto_kill_switch_objects_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_api_proto_kill_switch_objects_proto_goTypes = []interface{}{
	(Feature_Type)(0),                                  // 0: Feature.Type
	(KillSwitchAuthorizedUser_AccessLevel)(0),          // 1: KillSwitchAuthorizedUser.AccessLevel
	(*Feature)(nil),                                    // 2: Feature
	(*KillSwitch)(nil),                                 // 3: KillSwitch
	(*KillSwitchAuthorizedUser)(nil),                   // 4: KillSwitchAuthorizedUser
	(*KillSwitchTransformation)(nil),                   // 5: KillSwitchTransformation
	(*KillSwitchAuditLogEntry)(nil),                    // 6: KillSwitchAuditLogEntry
	(*KillSwitchAuditLogEntry_KillSwitchEnabled)(nil),  // 7: KillSwitchAuditLogEntry.KillSwitchEnabled
	(*KillSwitchAuditLogEntry_KillSwitchDisabled)(nil), // 8: KillSwitchAuditLogEntry.KillSwitchDisabled
	(Environment_Browser)(0),                           // 9: Environment.Browser
	(*timestamppb.Timestamp)(nil),                      // 10: google.protobuf.Timestamp
}
var file_api_proto_kill_switch_objects_proto_depIdxs = []int32{
	0,  // 0: Feature.type:type_name -> Feature.Type
	2,  // 1: KillSwitch.feature:type_name -> Feature
	9,  // 2: KillSwitch.browsers:type_name -> Environment.Browser
	1,  // 3: KillSwitchAuthorizedUser.access_level:type_name -> KillSwitchAuthorizedUser.AccessLevel
	3,  // 4: KillSwitchTransformation.kill_switch_from:type_name -> KillSwitch
	3,  // 5: KillSwitchTransformation.kill_switch_to:type_name -> KillSwitch
	10, // 6: KillSwitchAuditLogEntry.timestamp:type_name -> google.protobuf.Timestamp
	4,  // 7: KillSwitchAuditLogEntry.user:type_name -> KillSwitchAuthorizedUser
	7,  // 8: KillSwitchAuditLogEntry.kill_switch_enabled:type_name -> KillSwitchAuditLogEntry.KillSwitchEnabled
	8,  // 9: KillSwitchAuditLogEntry.kill_switch_disabled:type_name -> KillSwitchAuditLogEntry.KillSwitchDisabled
	5,  // 10: KillSwitchAuditLogEntry.KillSwitchEnabled.transformation:type_name -> KillSwitchTransformation
	5,  // 11: KillSwitchAuditLogEntry.KillSwitchDisabled.transformation:type_name -> KillSwitchTransformation
	12, // [12:12] is the sub-list for method output_type
	12, // [12:12] is the sub-list for method input_type
	12, // [12:12] is the sub-list for extension type_name
	12, // [12:12] is the sub-list for extension extendee
	0,  // [0:12] is the sub-list for field type_name
}

func init() { file_api_proto_kill_switch_objects_proto_init() }
func file_api_proto_kill_switch_objects_proto_init() {
	if File_api_proto_kill_switch_objects_proto != nil {
		return
	}
	file_api_proto_common_proto_init()
	if !protoimpl.UnsafeEnabled {
		file_api_proto_kill_switch_objects_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*Feature); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_api_proto_kill_switch_objects_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*KillSwitch); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_api_proto_kill_switch_objects_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*KillSwitchAuthorizedUser); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_api_proto_kill_switch_objects_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*KillSwitchTransformation); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_api_proto_kill_switch_objects_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*KillSwitchAuditLogEntry); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_api_proto_kill_switch_objects_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*KillSwitchAuditLogEntry_KillSwitchEnabled); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_api_proto_kill_switch_objects_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*KillSwitchAuditLogEntry_KillSwitchDisabled); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
	}
	file_api_proto_kill_switch_objects_proto_msgTypes[4].OneofWrappers = []interface{}{
		(*KillSwitchAuditLogEntry_KillSwitchEnabled_)(nil),
		(*KillSwitchAuditLogEntry_KillSwitchDisabled_)(nil),
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: file_api_proto_kill_switch_objects_proto_rawDesc,
			NumEnums:      2,
			NumMessages:   7,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_api_proto_kill_switch_objects_proto_goTypes,
		DependencyIndexes: file_api_proto_kill_switch_objects_proto_depIdxs,
		EnumInfos:         file_api_proto_kill_switch_objects_proto_enumTypes,
		MessageInfos:      file_api_proto_kill_switch_objects_proto_msgTypes,
	}.Build()
	File_api_proto_kill_switch_objects_proto = out.File
	file_api_proto_kill_switch_objects_proto_rawDesc = nil
	file_api_proto_kill_switch_objects_proto_goTypes = nil
	file_api_proto_kill_switch_objects_proto_depIdxs = nil
}
