// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1

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

package errors

import (
	api "github.com/hashicorp/boundary/internal/gen/controller/api"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	sync "sync"
	unsafe "unsafe"
)

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)
)

// Err is a protobuf representation of a domain error
type Err struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// code is the error's code, which can be used to get the error's
	// errorCodeInfo, which contains the error's Kind and Message
	Code uint32 `protobuf:"varint,10,opt,name=code,proto3" json:"code,omitempty"`
	// msg for the error
	Msg string `protobuf:"bytes,20,opt,name=msg,proto3" json:"msg,omitempty"`
	// op represents the operation raising/propagating an error and is optional.
	Op string `protobuf:"bytes,30,opt,name=op,proto3" json:"op,omitempty"`
	// wrapped represents an optionally wrapped error
	//
	// Types that are valid to be assigned to Wrapped:
	//
	//	*Err_Err
	//	*Err_StdError
	//	*Err_None
	Wrapped       isErr_Wrapped `protobuf_oneof:"wrapped"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Err) Reset() {
	*x = Err{}
	mi := &file_errors_v1_errors_proto_msgTypes[0]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

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

func (*Err) ProtoMessage() {}

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

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

func (x *Err) GetCode() uint32 {
	if x != nil {
		return x.Code
	}
	return 0
}

func (x *Err) GetMsg() string {
	if x != nil {
		return x.Msg
	}
	return ""
}

func (x *Err) GetOp() string {
	if x != nil {
		return x.Op
	}
	return ""
}

func (x *Err) GetWrapped() isErr_Wrapped {
	if x != nil {
		return x.Wrapped
	}
	return nil
}

func (x *Err) GetErr() *Err {
	if x != nil {
		if x, ok := x.Wrapped.(*Err_Err); ok {
			return x.Err
		}
	}
	return nil
}

func (x *Err) GetStdError() string {
	if x != nil {
		if x, ok := x.Wrapped.(*Err_StdError); ok {
			return x.StdError
		}
	}
	return ""
}

func (x *Err) GetNone() bool {
	if x != nil {
		if x, ok := x.Wrapped.(*Err_None); ok {
			return x.None
		}
	}
	return false
}

type isErr_Wrapped interface {
	isErr_Wrapped()
}

type Err_Err struct {
	// err is a wrapped Err (aka a domain error)
	Err *Err `protobuf:"bytes,40,opt,name=err,proto3,oneof"`
}

type Err_StdError struct {
	// std_error is a wrapped std error
	StdError string `protobuf:"bytes,50,opt,name=std_error,json=stdError,proto3,oneof"`
}

type Err_None struct {
	// no error or err is wrapped
	None bool `protobuf:"varint,60,opt,name=none,proto3,oneof"`
}

func (*Err_Err) isErr_Wrapped() {}

func (*Err_StdError) isErr_Wrapped() {}

func (*Err_None) isErr_Wrapped() {}

// ApiError is a protobuf representation of a controller ApiError
type ApiError struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// api_error is the controller ApiError
	ApiError *api.Error `protobuf:"bytes,10,opt,name=api_error,json=apiError,proto3" json:"api_error,omitempty"`
	// status is the status code assocatiated with the api error
	Status        int32 `protobuf:"varint,20,opt,name=status,proto3" json:"status,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *ApiError) Reset() {
	*x = ApiError{}
	mi := &file_errors_v1_errors_proto_msgTypes[1]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

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

func (*ApiError) ProtoMessage() {}

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

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

func (x *ApiError) GetApiError() *api.Error {
	if x != nil {
		return x.ApiError
	}
	return nil
}

func (x *ApiError) GetStatus() int32 {
	if x != nil {
		return x.Status
	}
	return 0
}

var File_errors_v1_errors_proto protoreflect.FileDescriptor

const file_errors_v1_errors_proto_rawDesc = "" +
	"\n" +
	"\x16errors/v1/errors.proto\x12\terrors.v1\x1a\x1dcontroller/api/v1/error.proto\"\x9f\x01\n" +
	"\x03Err\x12\x12\n" +
	"\x04code\x18\n" +
	" \x01(\rR\x04code\x12\x10\n" +
	"\x03msg\x18\x14 \x01(\tR\x03msg\x12\x0e\n" +
	"\x02op\x18\x1e \x01(\tR\x02op\x12\"\n" +
	"\x03err\x18( \x01(\v2\x0e.errors.v1.ErrH\x00R\x03err\x12\x1d\n" +
	"\tstd_error\x182 \x01(\tH\x00R\bstdError\x12\x14\n" +
	"\x04none\x18< \x01(\bH\x00R\x04noneB\t\n" +
	"\awrapped\"Y\n" +
	"\bApiError\x125\n" +
	"\tapi_error\x18\n" +
	" \x01(\v2\x18.controller.api.v1.ErrorR\bapiError\x12\x16\n" +
	"\x06status\x18\x14 \x01(\x05R\x06statusB:Z8github.com/hashicorp/boundary/internal/gen/errors;errorsb\x06proto3"

var (
	file_errors_v1_errors_proto_rawDescOnce sync.Once
	file_errors_v1_errors_proto_rawDescData []byte
)

func file_errors_v1_errors_proto_rawDescGZIP() []byte {
	file_errors_v1_errors_proto_rawDescOnce.Do(func() {
		file_errors_v1_errors_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_errors_v1_errors_proto_rawDesc), len(file_errors_v1_errors_proto_rawDesc)))
	})
	return file_errors_v1_errors_proto_rawDescData
}

var file_errors_v1_errors_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_errors_v1_errors_proto_goTypes = []any{
	(*Err)(nil),       // 0: errors.v1.Err
	(*ApiError)(nil),  // 1: errors.v1.ApiError
	(*api.Error)(nil), // 2: controller.api.v1.Error
}
var file_errors_v1_errors_proto_depIdxs = []int32{
	0, // 0: errors.v1.Err.err:type_name -> errors.v1.Err
	2, // 1: errors.v1.ApiError.api_error:type_name -> controller.api.v1.Error
	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_errors_v1_errors_proto_init() }
func file_errors_v1_errors_proto_init() {
	if File_errors_v1_errors_proto != nil {
		return
	}
	file_errors_v1_errors_proto_msgTypes[0].OneofWrappers = []any{
		(*Err_Err)(nil),
		(*Err_StdError)(nil),
		(*Err_None)(nil),
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_errors_v1_errors_proto_rawDesc), len(file_errors_v1_errors_proto_rawDesc)),
			NumEnums:      0,
			NumMessages:   2,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_errors_v1_errors_proto_goTypes,
		DependencyIndexes: file_errors_v1_errors_proto_depIdxs,
		MessageInfos:      file_errors_v1_errors_proto_msgTypes,
	}.Build()
	File_errors_v1_errors_proto = out.File
	file_errors_v1_errors_proto_goTypes = nil
	file_errors_v1_errors_proto_depIdxs = nil
}
