// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/scheduler/v2/scheduler.proto

package scheduler

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

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

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

	var errors []error

	if m.GetDownload() == nil {
		err := RegisterPeerRequestValidationError{
			field:  "Download",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = RegisterPeerRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetDownload() == nil {
		err := RegisterSeedPeerRequestValidationError{
			field:  "Download",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = RegisterSeedPeerRequestValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPeerStartedRequestValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetDescription()) < 1 {
		err := DownloadPeerBackToSourceStartedRequestValidationError{
			field:  "Description",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPeerBackToSourceStartedRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetContentLength() < 0 {
		err := DownloadPeerFinishedRequestValidationError{
			field:  "ContentLength",
			reason: "value must be greater than or equal to 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetPieceCount() < 0 {
		err := DownloadPeerFinishedRequestValidationError{
			field:  "PieceCount",
			reason: "value must be greater than or equal to 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPeerFinishedRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetContentLength() < 0 {
		err := DownloadPeerBackToSourceFinishedRequestValidationError{
			field:  "ContentLength",
			reason: "value must be greater than or equal to 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetPieceCount() < 0 {
		err := DownloadPeerBackToSourceFinishedRequestValidationError{
			field:  "PieceCount",
			reason: "value must be greater than or equal to 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPeerBackToSourceFinishedRequestValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetDescription()) < 1 {
		err := DownloadPeerFailedRequestValidationError{
			field:  "Description",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPeerFailedRequestValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetDescription()) < 1 {
		err := DownloadPeerBackToSourceFailedRequestValidationError{
			field:  "Description",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPeerBackToSourceFailedRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetPiece() == nil {
		err := DownloadPieceFinishedRequestValidationError{
			field:  "Piece",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPieceFinishedRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetPiece() == nil {
		err := DownloadPieceBackToSourceFinishedRequestValidationError{
			field:  "Piece",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPieceBackToSourceFinishedRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetPiece() == nil {
		err := DownloadPieceFailedRequestValidationError{
			field:  "Piece",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	// no validation rules for Temporary

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPieceFailedRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Header

	if val := m.GetStatusCode(); val < 100 || val >= 599 {
		err := HTTPResponseValidationError{
			field:  "StatusCode",
			reason: "value must be inside range [100, 599)",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetStatus()) < 1 {
		err := HTTPResponseValidationError{
			field:  "Status",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = HTTPResponseValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = HDFSResponseValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = S3ResponseValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = OSSResponseValidationError{}

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

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

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

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

	var errors []error

	if m.GetPiece() == nil {
		err := DownloadPieceBackToSourceFailedRequestValidationError{
			field:  "Piece",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

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

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

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

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

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

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DownloadPieceBackToSourceFailedRequestValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetParentId()) < 1 {
		err := SyncPiecesFailedRequestValidationError{
			field:  "ParentId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for Description

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SyncPiecesFailedRequestValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetHostId()) < 1 {
		err := AnnouncePeerRequestValidationError{
			field:  "HostId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetTaskId()) < 1 {
		err := AnnouncePeerRequestValidationError{
			field:  "TaskId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetPeerId()) < 1 {
		err := AnnouncePeerRequestValidationError{
			field:  "PeerId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	case *AnnouncePeerRequest_RegisterSeedPeerRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPeerStartedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPeerBackToSourceStartedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPeerFinishedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPeerBackToSourceFinishedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPeerFailedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPeerBackToSourceFailedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPieceFinishedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPieceBackToSourceFinishedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPieceFailedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_DownloadPieceBackToSourceFailedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *AnnouncePeerRequest_SyncPiecesFailedRequest:
		if v == nil {
			err := AnnouncePeerRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = AnnouncePeerRequestValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = EmptyTaskResponseValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TinyTaskResponseValidationError{}

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

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

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

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

	var errors []error

	if m.GetCandidateParent() == nil {
		err := SmallTaskResponseValidationError{
			field:  "CandidateParent",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SmallTaskResponseValidationError{}

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

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

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

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

	var errors []error

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

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

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

	}

	if m.GetConcurrentPieceCount() < 1 {
		err := NormalTaskResponseValidationError{
			field:  "ConcurrentPieceCount",
			reason: "value must be greater than or equal to 1",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = NormalTaskResponseValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetDescription()) < 1 {
		err := NeedBackToSourceResponseValidationError{
			field:  "Description",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = NeedBackToSourceResponseValidationError{}

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

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

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

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

	var errors []error

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

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

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

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

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

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

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

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

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = AnnouncePeerResponseValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetHostId()) < 1 {
		err := StatPeerRequestValidationError{
			field:  "HostId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetTaskId()) < 1 {
		err := StatPeerRequestValidationError{
			field:  "TaskId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetPeerId()) < 1 {
		err := StatPeerRequestValidationError{
			field:  "PeerId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = StatPeerRequestValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetHostId()) < 1 {
		err := ExchangePeerRequestValidationError{
			field:  "HostId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetTaskId()) < 1 {
		err := ExchangePeerRequestValidationError{
			field:  "TaskId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetPeerId()) < 1 {
		err := ExchangePeerRequestValidationError{
			field:  "PeerId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ExchangePeerRequestValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ExchangePeerResponseValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetHostId()) < 1 {
		err := LeavePeerRequestValidationError{
			field:  "HostId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetTaskId()) < 1 {
		err := LeavePeerRequestValidationError{
			field:  "TaskId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetPeerId()) < 1 {
		err := LeavePeerRequestValidationError{
			field:  "PeerId",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = LeavePeerRequestValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetId()) < 1 {
		err := StatTaskRequestValidationError{
			field:  "Id",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = StatTaskRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetHost() == nil {
		err := AnnounceHostRequestValidationError{
			field:  "Host",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = AnnounceHostRequestValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetId()) < 1 {
		err := LeaveHostRequestValidationError{
			field:  "Id",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = LeaveHostRequestValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ProbeStartedRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetHost() == nil {
		err := ProbeValidationError{
			field:  "Host",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	if m.GetRtt() == nil {
		err := ProbeValidationError{
			field:  "Rtt",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetCreatedAt() == nil {
		err := ProbeValidationError{
			field:  "CreatedAt",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ProbeValidationError{}

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

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

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

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

	var errors []error

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

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ProbeFinishedRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetHost() == nil {
		err := FailedProbeValidationError{
			field:  "Host",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	if utf8.RuneCountInString(m.GetDescription()) < 1 {
		err := FailedProbeValidationError{
			field:  "Description",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = FailedProbeValidationError{}

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

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

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

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

	var errors []error

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

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ProbeFailedRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetHost() == nil {
		err := SyncProbesRequestValidationError{
			field:  "Host",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

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

	case *SyncProbesRequest_ProbeFinishedRequest:
		if v == nil {
			err := SyncProbesRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

	case *SyncProbesRequest_ProbeFailedRequest:
		if v == nil {
			err := SyncProbesRequestValidationError{
				field:  "Request",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}
		oneofRequestPresent = true

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SyncProbesRequestValidationError{}

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

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

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

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

	var errors []error

	if len(m.GetHosts()) > 0 {

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

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

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

		}

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SyncProbesResponseValidationError{}

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