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

package statsv3

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = StatFullNameMatchInputValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = StatTagValueInputValidationError{}

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