//
// Copyright 2024 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.31.0
// 	protoc        (unknown)
// source: controlplane/config/v1/config.proto

package v1

import (
	_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
	v1 "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	durationpb "google.golang.org/protobuf/types/known/durationpb"
	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)
)

// OnboardingSpec is a configuration to automatically onboard users in organizations with specific roles
type OnboardingSpec struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	// Name of the organization
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Role to assign to the user
	Role v1.MembershipRole `protobuf:"varint,2,opt,name=role,proto3,enum=controlplane.v1.MembershipRole" json:"role,omitempty"`
}

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

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

func (*OnboardingSpec) ProtoMessage() {}

func (x *OnboardingSpec) ProtoReflect() protoreflect.Message {
	mi := &file_controlplane_config_v1_config_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 OnboardingSpec.ProtoReflect.Descriptor instead.
func (*OnboardingSpec) Descriptor() ([]byte, []int) {
	return file_controlplane_config_v1_config_proto_rawDescGZIP(), []int{0}
}

func (x *OnboardingSpec) GetName() string {
	if x != nil {
		return x.Name
	}
	return ""
}

func (x *OnboardingSpec) GetRole() v1.MembershipRole {
	if x != nil {
		return x.Role
	}
	return v1.MembershipRole(0)
}

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

	// allow_list is a list of allowed email addresses or domains
	// for example ["@chainloop.dev", "foo@mycompany.org"]
	Rules []string `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
	// Custom message to show when a user is not allowed
	CustomMessage string `protobuf:"bytes,2,opt,name=custom_message,json=customMessage,proto3" json:"custom_message,omitempty"`
	// The list of routes that will be affected by this middleware, by default all of them
	SelectedRoutes []string `protobuf:"bytes,3,rep,name=selected_routes,json=selectedRoutes,proto3" json:"selected_routes,omitempty"`
	// Whether to treat the information stored in the user table as the source of truth
	// if false, the allowList rules will be used as source of truth
	// if true, the allowList rules will be used as a starting point to populate the property in the DB
	AllowDbOverrides bool `protobuf:"varint,4,opt,name=allow_db_overrides,json=allowDbOverrides,proto3" json:"allow_db_overrides,omitempty"`
}

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

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

func (*AllowList) ProtoMessage() {}

func (x *AllowList) ProtoReflect() protoreflect.Message {
	mi := &file_controlplane_config_v1_config_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 AllowList.ProtoReflect.Descriptor instead.
func (*AllowList) Descriptor() ([]byte, []int) {
	return file_controlplane_config_v1_config_proto_rawDescGZIP(), []int{1}
}

func (x *AllowList) GetRules() []string {
	if x != nil {
		return x.Rules
	}
	return nil
}

func (x *AllowList) GetCustomMessage() string {
	if x != nil {
		return x.CustomMessage
	}
	return ""
}

func (x *AllowList) GetSelectedRoutes() []string {
	if x != nil {
		return x.SelectedRoutes
	}
	return nil
}

func (x *AllowList) GetAllowDbOverrides() bool {
	if x != nil {
		return x.AllowDbOverrides
	}
	return false
}

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

	Driver          string               `protobuf:"bytes,1,opt,name=driver,proto3" json:"driver,omitempty"`
	Source          string               `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
	MinOpenConns    int32                `protobuf:"varint,3,opt,name=min_open_conns,json=minOpenConns,proto3" json:"min_open_conns,omitempty"`
	MaxOpenConns    int32                `protobuf:"varint,4,opt,name=max_open_conns,json=maxOpenConns,proto3" json:"max_open_conns,omitempty"`
	MaxConnIdleTime *durationpb.Duration `protobuf:"bytes,5,opt,name=max_conn_idle_time,json=maxConnIdleTime,proto3" json:"max_conn_idle_time,omitempty"`
}

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

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

func (*DatabaseConfig) ProtoMessage() {}

func (x *DatabaseConfig) ProtoReflect() protoreflect.Message {
	mi := &file_controlplane_config_v1_config_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 DatabaseConfig.ProtoReflect.Descriptor instead.
func (*DatabaseConfig) Descriptor() ([]byte, []int) {
	return file_controlplane_config_v1_config_proto_rawDescGZIP(), []int{2}
}

func (x *DatabaseConfig) GetDriver() string {
	if x != nil {
		return x.Driver
	}
	return ""
}

func (x *DatabaseConfig) GetSource() string {
	if x != nil {
		return x.Source
	}
	return ""
}

func (x *DatabaseConfig) GetMinOpenConns() int32 {
	if x != nil {
		return x.MinOpenConns
	}
	return 0
}

func (x *DatabaseConfig) GetMaxOpenConns() int32 {
	if x != nil {
		return x.MaxOpenConns
	}
	return 0
}

func (x *DatabaseConfig) GetMaxConnIdleTime() *durationpb.Duration {
	if x != nil {
		return x.MaxConnIdleTime
	}
	return nil
}

var File_controlplane_config_v1_config_proto protoreflect.FileDescriptor

var file_controlplane_config_v1_config_proto_rawDesc = []byte{
	0x0a, 0x23, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x63,
	0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e,
	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c,
	0x61, 0x6e, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62,
	0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69,
	0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x63, 0x6f, 0x6e, 0x74,
	0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x70,
	0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72,
	0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
	0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72,
	0x6f, 0x74, 0x6f, 0x22, 0x6f, 0x0a, 0x0e, 0x4f, 0x6e, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x69, 0x6e,
	0x67, 0x53, 0x70, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
	0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x04, 0x6e, 0x61,
	0x6d, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e,
	0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e,
	0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x6f, 0x6c,
	0x65, 0x42, 0x0b, 0xba, 0x48, 0x08, 0x82, 0x01, 0x05, 0x10, 0x01, 0x22, 0x01, 0x00, 0x52, 0x04,
	0x72, 0x6f, 0x6c, 0x65, 0x22, 0x9f, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x4c, 0x69,
	0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
	0x09, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x75, 0x73, 0x74,
	0x6f, 0x6d, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
	0x52, 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12,
	0x27, 0x0a, 0x0f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x75, 0x74,
	0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74,
	0x65, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x6c, 0x6c, 0x6f,
	0x77, 0x5f, 0x64, 0x62, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x18, 0x04,
	0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x44, 0x62, 0x4f, 0x76, 0x65,
	0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x22, 0xd4, 0x01, 0x0a, 0x0e, 0x44, 0x61, 0x74, 0x61, 0x62,
	0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x72, 0x69,
	0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65,
	0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
	0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6d, 0x69, 0x6e,
	0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
	0x05, 0x52, 0x0c, 0x6d, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x12,
	0x24, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x6e,
	0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x4f, 0x70, 0x65, 0x6e,
	0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x46, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x6e,
	0x6e, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
	0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
	0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x6d, 0x61,
	0x78, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x58, 0x5a,
	0x56, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x61, 0x69,
	0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c,
	0x6f, 0x6f, 0x70, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70,
	0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x63, 0x6f,
	0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69,
	0x67, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

var (
	file_controlplane_config_v1_config_proto_rawDescOnce sync.Once
	file_controlplane_config_v1_config_proto_rawDescData = file_controlplane_config_v1_config_proto_rawDesc
)

func file_controlplane_config_v1_config_proto_rawDescGZIP() []byte {
	file_controlplane_config_v1_config_proto_rawDescOnce.Do(func() {
		file_controlplane_config_v1_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_controlplane_config_v1_config_proto_rawDescData)
	})
	return file_controlplane_config_v1_config_proto_rawDescData
}

var file_controlplane_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_controlplane_config_v1_config_proto_goTypes = []interface{}{
	(*OnboardingSpec)(nil),      // 0: controlplane.config.v1.OnboardingSpec
	(*AllowList)(nil),           // 1: controlplane.config.v1.AllowList
	(*DatabaseConfig)(nil),      // 2: controlplane.config.v1.DatabaseConfig
	(v1.MembershipRole)(0),      // 3: controlplane.v1.MembershipRole
	(*durationpb.Duration)(nil), // 4: google.protobuf.Duration
}
var file_controlplane_config_v1_config_proto_depIdxs = []int32{
	3, // 0: controlplane.config.v1.OnboardingSpec.role:type_name -> controlplane.v1.MembershipRole
	4, // 1: controlplane.config.v1.DatabaseConfig.max_conn_idle_time:type_name -> google.protobuf.Duration
	2, // [2:2] is the sub-list for method output_type
	2, // [2:2] is the sub-list for method input_type
	2, // [2:2] is the sub-list for extension type_name
	2, // [2:2] is the sub-list for extension extendee
	0, // [0:2] is the sub-list for field type_name
}

func init() { file_controlplane_config_v1_config_proto_init() }
func file_controlplane_config_v1_config_proto_init() {
	if File_controlplane_config_v1_config_proto != nil {
		return
	}
	if !protoimpl.UnsafeEnabled {
		file_controlplane_config_v1_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*OnboardingSpec); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_controlplane_config_v1_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*AllowList); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_controlplane_config_v1_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*DatabaseConfig); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: file_controlplane_config_v1_config_proto_rawDesc,
			NumEnums:      0,
			NumMessages:   3,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_controlplane_config_v1_config_proto_goTypes,
		DependencyIndexes: file_controlplane_config_v1_config_proto_depIdxs,
		MessageInfos:      file_controlplane_config_v1_config_proto_msgTypes,
	}.Build()
	File_controlplane_config_v1_config_proto = out.File
	file_controlplane_config_v1_config_proto_rawDesc = nil
	file_controlplane_config_v1_config_proto_goTypes = nil
	file_controlplane_config_v1_config_proto_depIdxs = nil
}
