// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: authzed/api/v0/developer.proto

package v0

import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"sort"
	"strings"
	"time"
	"unicode/utf8"

	"google.golang.org/protobuf/types/known/anypb"
)

// ensure the imports are used
var (
	_ = bytes.MinRead
	_ = errors.New("")
	_ = fmt.Print
	_ = utf8.UTFMax
	_ = (*regexp.Regexp)(nil)
	_ = (*strings.Reader)(nil)
	_ = net.IPv4len
	_ = time.Duration(0)
	_ = (*url.URL)(nil)
	_ = (*mail.Address)(nil)
	_ = anypb.Any{}
	_ = sort.Sort
)

// Validate checks the field values on ShareRequest with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *ShareRequest) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ShareRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in ShareRequestMultiError, or
// nil if none found.
func (m *ShareRequest) ValidateAll() error {
	return m.validate(true)
}

func (m *ShareRequest) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	// no validation rules for Schema

	// no validation rules for RelationshipsYaml

	// no validation rules for ValidationYaml

	// no validation rules for AssertionsYaml

	if len(errors) > 0 {
		return ShareRequestMultiError(errors)
	}

	return nil
}

// ShareRequestMultiError is an error wrapping multiple validation errors
// returned by ShareRequest.ValidateAll() if the designated constraints aren't met.
type ShareRequestMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m ShareRequestMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m ShareRequestMultiError) AllErrors() []error { return m }

// ShareRequestValidationError is the validation error returned by
// ShareRequest.Validate if the designated constraints aren't met.
type ShareRequestValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e ShareRequestValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e ShareRequestValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e ShareRequestValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e ShareRequestValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e ShareRequestValidationError) ErrorName() string { return "ShareRequestValidationError" }

// Error satisfies the builtin error interface
func (e ShareRequestValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sShareRequest.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ShareRequestValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ShareRequestValidationError{}

// Validate checks the field values on ShareResponse with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *ShareResponse) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ShareResponse with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in ShareResponseMultiError, or
// nil if none found.
func (m *ShareResponse) ValidateAll() error {
	return m.validate(true)
}

func (m *ShareResponse) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	// no validation rules for ShareReference

	if len(errors) > 0 {
		return ShareResponseMultiError(errors)
	}

	return nil
}

// ShareResponseMultiError is an error wrapping multiple validation errors
// returned by ShareResponse.ValidateAll() if the designated constraints
// aren't met.
type ShareResponseMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m ShareResponseMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m ShareResponseMultiError) AllErrors() []error { return m }

// ShareResponseValidationError is the validation error returned by
// ShareResponse.Validate if the designated constraints aren't met.
type ShareResponseValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e ShareResponseValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e ShareResponseValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e ShareResponseValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e ShareResponseValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e ShareResponseValidationError) ErrorName() string { return "ShareResponseValidationError" }

// Error satisfies the builtin error interface
func (e ShareResponseValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sShareResponse.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ShareResponseValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = ShareResponseValidationError{}

// Validate checks the field values on LookupShareRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *LookupShareRequest) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on LookupShareRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// LookupShareRequestMultiError, or nil if none found.
func (m *LookupShareRequest) ValidateAll() error {
	return m.validate(true)
}

func (m *LookupShareRequest) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	// no validation rules for ShareReference

	if len(errors) > 0 {
		return LookupShareRequestMultiError(errors)
	}

	return nil
}

// LookupShareRequestMultiError is an error wrapping multiple validation errors
// returned by LookupShareRequest.ValidateAll() if the designated constraints
// aren't met.
type LookupShareRequestMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m LookupShareRequestMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m LookupShareRequestMultiError) AllErrors() []error { return m }

// LookupShareRequestValidationError is the validation error returned by
// LookupShareRequest.Validate if the designated constraints aren't met.
type LookupShareRequestValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e LookupShareRequestValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e LookupShareRequestValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e LookupShareRequestValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e LookupShareRequestValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e LookupShareRequestValidationError) ErrorName() string {
	return "LookupShareRequestValidationError"
}

// Error satisfies the builtin error interface
func (e LookupShareRequestValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sLookupShareRequest.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = LookupShareRequestValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = LookupShareRequestValidationError{}

// Validate checks the field values on LookupShareResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *LookupShareResponse) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on LookupShareResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// LookupShareResponseMultiError, or nil if none found.
func (m *LookupShareResponse) ValidateAll() error {
	return m.validate(true)
}

func (m *LookupShareResponse) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	// no validation rules for Status

	// no validation rules for Schema

	// no validation rules for RelationshipsYaml

	// no validation rules for ValidationYaml

	// no validation rules for AssertionsYaml

	if len(errors) > 0 {
		return LookupShareResponseMultiError(errors)
	}

	return nil
}

// LookupShareResponseMultiError is an error wrapping multiple validation
// errors returned by LookupShareResponse.ValidateAll() if the designated
// constraints aren't met.
type LookupShareResponseMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m LookupShareResponseMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m LookupShareResponseMultiError) AllErrors() []error { return m }

// LookupShareResponseValidationError is the validation error returned by
// LookupShareResponse.Validate if the designated constraints aren't met.
type LookupShareResponseValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e LookupShareResponseValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e LookupShareResponseValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e LookupShareResponseValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e LookupShareResponseValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e LookupShareResponseValidationError) ErrorName() string {
	return "LookupShareResponseValidationError"
}

// Error satisfies the builtin error interface
func (e LookupShareResponseValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sLookupShareResponse.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = LookupShareResponseValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = LookupShareResponseValidationError{}
