//go:build !disable_pgv
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: envoy/extensions/matching/common_inputs/network/v3/network_inputs.proto

package networkv3

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 DestinationIPInput 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 *DestinationIPInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DestinationIPInput 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
// DestinationIPInputMultiError, or nil if none found.
func (m *DestinationIPInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = DestinationIPInputValidationError{}

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

// Validate checks the field values on DestinationPortInput 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 *DestinationPortInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DestinationPortInput 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
// DestinationPortInputMultiError, or nil if none found.
func (m *DestinationPortInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = DestinationPortInputValidationError{}

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

// Validate checks the field values on SourceIPInput 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 *SourceIPInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on SourceIPInput 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 SourceIPInputMultiError, or
// nil if none found.
func (m *SourceIPInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = SourceIPInputValidationError{}

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

// Validate checks the field values on SourcePortInput 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 *SourcePortInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on SourcePortInput 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
// SourcePortInputMultiError, or nil if none found.
func (m *SourcePortInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = SourcePortInputValidationError{}

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

// Validate checks the field values on DirectSourceIPInput 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 *DirectSourceIPInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DirectSourceIPInput 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
// DirectSourceIPInputMultiError, or nil if none found.
func (m *DirectSourceIPInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = DirectSourceIPInputValidationError{}

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

// Validate checks the field values on SourceTypeInput 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 *SourceTypeInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on SourceTypeInput 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
// SourceTypeInputMultiError, or nil if none found.
func (m *SourceTypeInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = SourceTypeInputValidationError{}

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

// Validate checks the field values on ServerNameInput 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 *ServerNameInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ServerNameInput 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
// ServerNameInputMultiError, or nil if none found.
func (m *ServerNameInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = ServerNameInputValidationError{}

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

// Validate checks the field values on TransportProtocolInput 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 *TransportProtocolInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on TransportProtocolInput 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
// TransportProtocolInputMultiError, or nil if none found.
func (m *TransportProtocolInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = TransportProtocolInputValidationError{}

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

// Validate checks the field values on ApplicationProtocolInput 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 *ApplicationProtocolInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on ApplicationProtocolInput 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
// ApplicationProtocolInputMultiError, or nil if none found.
func (m *ApplicationProtocolInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = ApplicationProtocolInputValidationError{}

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

// Validate checks the field values on FilterStateInput 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 *FilterStateInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on FilterStateInput 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
// FilterStateInputMultiError, or nil if none found.
func (m *FilterStateInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	if utf8.RuneCountInString(m.GetKey()) < 1 {
		err := FilterStateInputValidationError{
			field:  "Key",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = FilterStateInputValidationError{}

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

// Validate checks the field values on DynamicMetadataInput 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 *DynamicMetadataInput) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DynamicMetadataInput 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
// DynamicMetadataInputMultiError, or nil if none found.
func (m *DynamicMetadataInput) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	if utf8.RuneCountInString(m.GetFilter()) < 1 {
		err := DynamicMetadataInputValidationError{
			field:  "Filter",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(m.GetPath()) < 1 {
		err := DynamicMetadataInputValidationError{
			field:  "Path",
			reason: "value must contain at least 1 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	for idx, item := range m.GetPath() {
		_, _ = idx, item

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, DynamicMetadataInputValidationError{
						field:  fmt.Sprintf("Path[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, DynamicMetadataInputValidationError{
						field:  fmt.Sprintf("Path[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return DynamicMetadataInputValidationError{
					field:  fmt.Sprintf("Path[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = DynamicMetadataInputValidationError{}

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

// Validate checks the field values on DynamicMetadataInput_PathSegment 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 *DynamicMetadataInput_PathSegment) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on DynamicMetadataInput_PathSegment 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
// DynamicMetadataInput_PathSegmentMultiError, or nil if none found.
func (m *DynamicMetadataInput_PathSegment) ValidateAll() error {
	return m.validate(true)
}

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

	var errors []error

	oneofSegmentPresent := false
	switch v := m.Segment.(type) {
	case *DynamicMetadataInput_PathSegment_Key:
		if v == nil {
			err := DynamicMetadataInput_PathSegmentValidationError{
				field:  "Segment",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofSegmentPresent = true

		if utf8.RuneCountInString(m.GetKey()) < 1 {
			err := DynamicMetadataInput_PathSegmentValidationError{
				field:  "Key",
				reason: "value length must be at least 1 runes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	default:
		_ = v // ensures v is used
	}
	if !oneofSegmentPresent {
		err := DynamicMetadataInput_PathSegmentValidationError{
			field:  "Segment",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = DynamicMetadataInput_PathSegmentValidationError{}

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