// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: authzed/api/materialize/v0/watchpermissionsets.proto

package v0

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = WatchPermissionSetsRequestValidationError{}

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

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

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

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

	var errors []error

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

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

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

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

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

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

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = WatchPermissionSetsResponseValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Limit

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

	// no validation rules for StartingIndex

	// no validation rules for CompletedMembers

	// no validation rules for StartingKey

	// no validation rules for Cursor

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CursorValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Limit

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = LookupPermissionSetsRequestValidationError{}

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

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

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

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

	var errors []error

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = LookupPermissionSetsResponseValidationError{}

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

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

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

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

	var errors []error

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

	// no validation rules for Operation

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

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

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

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PermissionSetChangeValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ObjectType

	// no validation rules for ObjectId

	// no validation rules for PermissionOrRelation

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SetReferenceValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for ObjectType

	// no validation rules for ObjectId

	// no validation rules for OptionalPermissionOrRelation

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = MemberReferenceValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = LookupPermissionSetsRequiredValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = BreakingSchemaChangeValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPermissionSetsRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Name

	// no validation rules for Url

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = FileValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPermissionSetsResponseValidationError{}

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