// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: envoy/extensions/filters/http/ext_proc/v3alpha/ext_proc.proto

package envoy_extensions_filters_http_ext_proc_v3alpha

import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"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{}
)

// Validate checks the field values on ExternalProcessor with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *ExternalProcessor) Validate() error {
	if m == nil {
		return nil
	}

	if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return ExternalProcessorValidationError{
				field:  "GrpcService",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	// no validation rules for FailureModeAllow

	if v, ok := interface{}(m.GetProcessingMode()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return ExternalProcessorValidationError{
				field:  "ProcessingMode",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	// no validation rules for AsyncMode

	if v, ok := interface{}(m.GetMessageTimeout()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return ExternalProcessorValidationError{
				field:  "MessageTimeout",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	// no validation rules for StatPrefix

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ExternalProcessorValidationError) 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 %sExternalProcessor.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ExternalProcessorValidationError{}

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

// Validate checks the field values on ExtProcPerRoute with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *ExtProcPerRoute) Validate() error {
	if m == nil {
		return nil
	}

	switch m.Override.(type) {

	case *ExtProcPerRoute_Disabled:

		if m.GetDisabled() != true {
			return ExtProcPerRouteValidationError{
				field:  "Disabled",
				reason: "value must equal true",
			}
		}

	case *ExtProcPerRoute_Overrides:

		if v, ok := interface{}(m.GetOverrides()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return ExtProcPerRouteValidationError{
					field:  "Overrides",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		return ExtProcPerRouteValidationError{
			field:  "Override",
			reason: "value is required",
		}

	}

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ExtProcPerRouteValidationError) 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 %sExtProcPerRoute.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ExtProcPerRouteValidationError{}

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

// Validate checks the field values on ExtProcOverrides with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *ExtProcOverrides) Validate() error {
	if m == nil {
		return nil
	}

	if v, ok := interface{}(m.GetProcessingMode()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return ExtProcOverridesValidationError{
				field:  "ProcessingMode",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	// no validation rules for AsyncMode

	return nil
}

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

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

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

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

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

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

// Error satisfies the builtin error interface
func (e ExtProcOverridesValidationError) 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 %sExtProcOverrides.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = ExtProcOverridesValidationError{}

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