// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: xds/type/matcher/v3/matcher.proto

package v3

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

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

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

	var errors []error

	if all {
		switch v := interface{}(m.GetOnNoMatch()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, MatcherValidationError{
					field:  "OnNoMatch",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, MatcherValidationError{
					field:  "OnNoMatch",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetOnNoMatch()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return MatcherValidationError{
				field:  "OnNoMatch",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	switch v := m.MatcherType.(type) {
	case *Matcher_MatcherList_:
		if v == nil {
			err := MatcherValidationError{
				field:  "MatcherType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if all {
			switch v := interface{}(m.GetMatcherList()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatcherValidationError{
						field:  "MatcherList",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatcherValidationError{
						field:  "MatcherList",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetMatcherList()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatcherValidationError{
					field:  "MatcherList",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherTree_:
		if v == nil {
			err := MatcherValidationError{
				field:  "MatcherType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

		if all {
			switch v := interface{}(m.GetMatcherTree()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, MatcherValidationError{
						field:  "MatcherTree",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, MatcherValidationError{
						field:  "MatcherTree",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetMatcherTree()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return MatcherValidationError{
					field:  "MatcherTree",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m MatcherMultiError) 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 MatcherMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = MatcherValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for KeepMatching

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

		if all {
			switch v := interface{}(m.GetMatcher()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_OnMatchValidationError{
						field:  "Matcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_OnMatchValidationError{
						field:  "Matcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_OnMatchValidationError{
					field:  "Matcher",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_OnMatch_Action:
		if v == nil {
			err := Matcher_OnMatchValidationError{
				field:  "OnMatch",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofOnMatchPresent = true

		if all {
			switch v := interface{}(m.GetAction()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_OnMatchValidationError{
						field:  "Action",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_OnMatchValidationError{
						field:  "Action",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_OnMatchValidationError{
					field:  "Action",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

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

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_OnMatchMultiError) 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 Matcher_OnMatchMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = Matcher_OnMatchValidationError{}

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

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

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

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

	var errors []error

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

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

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherListValidationError{
						field:  fmt.Sprintf("Matchers[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherListValidationError{
						field:  fmt.Sprintf("Matchers[%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 Matcher_MatcherListValidationError{
					field:  fmt.Sprintf("Matchers[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherListMultiError) 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 Matcher_MatcherListMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = Matcher_MatcherListValidationError{}

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

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

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

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

	var errors []error

	if m.GetInput() == nil {
		err := Matcher_MatcherTreeValidationError{
			field:  "Input",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetInput()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, Matcher_MatcherTreeValidationError{
					field:  "Input",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, Matcher_MatcherTreeValidationError{
					field:  "Input",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return Matcher_MatcherTreeValidationError{
				field:  "Input",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

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

		if all {
			switch v := interface{}(m.GetExactMatchMap()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "ExactMatchMap",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "ExactMatchMap",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetExactMatchMap()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherTreeValidationError{
					field:  "ExactMatchMap",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherTree_PrefixMatchMap:
		if v == nil {
			err := Matcher_MatcherTreeValidationError{
				field:  "TreeType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofTreeTypePresent = true

		if all {
			switch v := interface{}(m.GetPrefixMatchMap()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "PrefixMatchMap",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "PrefixMatchMap",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetPrefixMatchMap()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherTreeValidationError{
					field:  "PrefixMatchMap",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherTree_CustomMatch:
		if v == nil {
			err := Matcher_MatcherTreeValidationError{
				field:  "TreeType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofTreeTypePresent = true

		if all {
			switch v := interface{}(m.GetCustomMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "CustomMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherTreeValidationError{
						field:  "CustomMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherTreeValidationError{
					field:  "CustomMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

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

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherTreeMultiError) 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 Matcher_MatcherTreeMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = Matcher_MatcherTreeValidationError{}

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

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

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

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

	var errors []error

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

		if all {
			switch v := interface{}(m.GetSinglePredicate()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "SinglePredicate",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "SinglePredicate",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetSinglePredicate()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_PredicateValidationError{
					field:  "SinglePredicate",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherList_Predicate_OrMatcher:
		if v == nil {
			err := Matcher_MatcherList_PredicateValidationError{
				field:  "MatchType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatchTypePresent = true

		if all {
			switch v := interface{}(m.GetOrMatcher()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "OrMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "OrMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetOrMatcher()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_PredicateValidationError{
					field:  "OrMatcher",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherList_Predicate_AndMatcher:
		if v == nil {
			err := Matcher_MatcherList_PredicateValidationError{
				field:  "MatchType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatchTypePresent = true

		if all {
			switch v := interface{}(m.GetAndMatcher()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "AndMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "AndMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetAndMatcher()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_PredicateValidationError{
					field:  "AndMatcher",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherList_Predicate_NotMatcher:
		if v == nil {
			err := Matcher_MatcherList_PredicateValidationError{
				field:  "MatchType",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatchTypePresent = true

		if all {
			switch v := interface{}(m.GetNotMatcher()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "NotMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_PredicateValidationError{
						field:  "NotMatcher",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetNotMatcher()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_PredicateValidationError{
					field:  "NotMatcher",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

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

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherList_PredicateMultiError) 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 Matcher_MatcherList_PredicateMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = Matcher_MatcherList_PredicateValidationError{}

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

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

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

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

	var errors []error

	if m.GetPredicate() == nil {
		err := Matcher_MatcherList_FieldMatcherValidationError{
			field:  "Predicate",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetPredicate()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
					field:  "Predicate",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
					field:  "Predicate",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetPredicate()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return Matcher_MatcherList_FieldMatcherValidationError{
				field:  "Predicate",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	if m.GetOnMatch() == nil {
		err := Matcher_MatcherList_FieldMatcherValidationError{
			field:  "OnMatch",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetOnMatch()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
					field:  "OnMatch",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, Matcher_MatcherList_FieldMatcherValidationError{
					field:  "OnMatch",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetOnMatch()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return Matcher_MatcherList_FieldMatcherValidationError{
				field:  "OnMatch",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherList_FieldMatcherMultiError) 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 Matcher_MatcherList_FieldMatcherMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = Matcher_MatcherList_FieldMatcherValidationError{}

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

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

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

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

	var errors []error

	if m.GetInput() == nil {
		err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
			field:  "Input",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetInput()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
					field:  "Input",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
					field:  "Input",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
				field:  "Input",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

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

		if all {
			switch v := interface{}(m.GetValueMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
						field:  "ValueMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
						field:  "ValueMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetValueMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
					field:  "ValueMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	case *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch:
		if v == nil {
			err := Matcher_MatcherList_Predicate_SinglePredicateValidationError{
				field:  "Matcher",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMatcherPresent = true

		if all {
			switch v := interface{}(m.GetCustomMatch()).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
						field:  "CustomMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_SinglePredicateValidationError{
						field:  "CustomMatch",
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			}
		} else if v, ok := interface{}(m.GetCustomMatch()).(interface{ Validate() error }); ok {
			if err := v.Validate(); err != nil {
				return Matcher_MatcherList_Predicate_SinglePredicateValidationError{
					field:  "CustomMatch",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

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

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherList_Predicate_SinglePredicateMultiError) 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 Matcher_MatcherList_Predicate_SinglePredicateMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = Matcher_MatcherList_Predicate_SinglePredicateValidationError{}

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

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

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

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

	var errors []error

	if len(m.GetPredicate()) < 2 {
		err := Matcher_MatcherList_Predicate_PredicateListValidationError{
			field:  "Predicate",
			reason: "value must contain at least 2 item(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

		if all {
			switch v := interface{}(item).(type) {
			case interface{ ValidateAll() error }:
				if err := v.ValidateAll(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{
						field:  fmt.Sprintf("Predicate[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					})
				}
			case interface{ Validate() error }:
				if err := v.Validate(); err != nil {
					errors = append(errors, Matcher_MatcherList_Predicate_PredicateListValidationError{
						field:  fmt.Sprintf("Predicate[%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 Matcher_MatcherList_Predicate_PredicateListValidationError{
					field:  fmt.Sprintf("Predicate[%v]", idx),
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}

	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherList_Predicate_PredicateListMultiError) 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 Matcher_MatcherList_Predicate_PredicateListMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = Matcher_MatcherList_Predicate_PredicateListValidationError{}

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

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

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

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

	var errors []error

	if len(m.GetMap()) < 1 {
		err := Matcher_MatcherTree_MatchMapValidationError{
			field:  "Map",
			reason: "value must contain at least 1 pair(s)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	{
		sorted_keys := make([]string, len(m.GetMap()))
		i := 0
		for key := range m.GetMap() {
			sorted_keys[i] = key
			i++
		}
		sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] })
		for _, key := range sorted_keys {
			val := m.GetMap()[key]
			_ = val

			// no validation rules for Map[key]

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

		}
	}

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m Matcher_MatcherTree_MatchMapMultiError) 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 Matcher_MatcherTree_MatchMapMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = Matcher_MatcherTree_MatchMapValidationError{}

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