// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: internal/tool/grpctool/test/test.proto

package test

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

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

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

	var errors []error

	if len(m.GetS1()) < 1 {
		err := RequestValidationError{
			field:  "S1",
			reason: "value length must be at least 1 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = RequestValidationError{}

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

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

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

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

	var errors []error

	oneofMessagePresent := false
	switch v := m.Message.(type) {
	case *Response_Scalar:
		if v == nil {
			err := ResponseValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMessagePresent = true
		// no validation rules for Scalar
	case *Response_X1:
		if v == nil {
			err := ResponseValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMessagePresent = true
		// no validation rules for X1
	case *Response_Data_:
		if v == nil {
			err := ResponseValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMessagePresent = true

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

	case *Response_Last_:
		if v == nil {
			err := ResponseValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofMessagePresent = true

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ResponseValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = NoOneofsValidationError{}

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

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

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

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

	var errors []error

	switch v := m.Message1.(type) {
	case *TwoOneofs_M11:
		if v == nil {
			err := TwoOneofsValidationError{
				field:  "Message1",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M11
	case *TwoOneofs_M12:
		if v == nil {
			err := TwoOneofsValidationError{
				field:  "Message1",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M12
	default:
		_ = v // ensures v is used
	}
	switch v := m.Message2.(type) {
	case *TwoOneofs_M21:
		if v == nil {
			err := TwoOneofsValidationError{
				field:  "Message2",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M21
	case *TwoOneofs_M22:
		if v == nil {
			err := TwoOneofsValidationError{
				field:  "Message2",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M22
	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TwoOneofsValidationError{}

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

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

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

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

	var errors []error

	switch v := m.Message1.(type) {
	case *TwoValidOneofs_M11:
		if v == nil {
			err := TwoValidOneofsValidationError{
				field:  "Message1",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M11
	case *TwoValidOneofs_M12:
		if v == nil {
			err := TwoValidOneofsValidationError{
				field:  "Message1",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M12
	default:
		_ = v // ensures v is used
	}
	switch v := m.Message2.(type) {
	case *TwoValidOneofs_M21:
		if v == nil {
			err := TwoValidOneofsValidationError{
				field:  "Message2",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M21
	case *TwoValidOneofs_M22:
		if v == nil {
			err := TwoValidOneofsValidationError{
				field:  "Message2",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M22
	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TwoValidOneofsValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for X

	switch v := m.Message.(type) {
	case *OutOfOneof_M1:
		if v == nil {
			err := OutOfOneofValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M1
	case *OutOfOneof_M2:
		if v == nil {
			err := OutOfOneofValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M2
	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = OutOfOneofValidationError{}

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

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

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

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

	var errors []error

	switch v := m.Message.(type) {
	case *NotAllReachable_M1:
		if v == nil {
			err := NotAllReachableValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M1
	case *NotAllReachable_M2:
		if v == nil {
			err := NotAllReachableValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M2
	case *NotAllReachable_M3:
		if v == nil {
			err := NotAllReachableValidationError{
				field:  "Message",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		// no validation rules for M3
	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = NotAllReachableValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Data

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = Response_DataValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = Response_LastValidationError{}

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