// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: impl/v1/impl.proto

package implv1

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

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

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

	var errors []error

	// no validation rules for Name

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DecodedCaveatValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Version

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

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

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DecodedZookieValidationError{}

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

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

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

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

	var errors []error

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

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

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DecodedZedTokenValidationError{}

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

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

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

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

	var errors []error

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DecodedCursorValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Revision

	// no validation rules for CallAndParametersHash

	// no validation rules for DispatchVersion

	// no validation rules for Flags

	// no validation rules for DatastoreUniqueId

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = V1CursorValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Comment

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DocCommentValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TypeAnnotationsValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Kind

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = RelationMetadataValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for NamespaceName

	// no validation rules for Revision

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = NamespaceAndRevisionValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = V1Alpha1RevisionValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Revision

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DecodedZookie_V1ZookieValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Revision

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DecodedZookie_V2ZookieValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Revision

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DecodedZedToken_V1ZookieValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Revision

	// no validation rules for DatastoreUniqueIdPrefix

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DecodedZedToken_V1ZedTokenValidationError{}

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