// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: server/proto/system.proto

package proto

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

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

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

	var errors []error

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

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

	}

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = BlockchainEventValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Network

	// no validation rules for Genesis

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

	// no validation rules for P2PAddr

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ServerStatusValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PeerValidationError{}

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

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

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

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

	var errors []error

	if !_PeersAddRequest_Id_Pattern.MatchString(m.GetId()) {
		err := PeersAddRequestValidationError{
			field:  "Id",
			reason: "value does not match regex pattern \"^\\\\/[A-Za-z0-9._~-]+(\\\\/[A-Za-z0-9._~-]+)*$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PeersAddRequestValidationError{}

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

var _PeersAddRequest_Id_Pattern = regexp.MustCompile("^\\/[A-Za-z0-9._~-]+(\\/[A-Za-z0-9._~-]+)*$")

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

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

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

	var errors []error

	// no validation rules for Message

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PeersAddResponseValidationError{}

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

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

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

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

	var errors []error

	if !_PeersStatusRequest_Id_Pattern.MatchString(m.GetId()) {
		err := PeersStatusRequestValidationError{
			field:  "Id",
			reason: "value does not match regex pattern \"^[A-Za-z0-9]{1,}$\"",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PeersStatusRequestValidationError{}

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

var _PeersStatusRequest_Id_Pattern = regexp.MustCompile("^[A-Za-z0-9]{1,}$")

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PeersListResponseValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Number

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = BlockByNumberRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Data

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = BlockResponseValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for From

	// no validation rules for To

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ExportRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for From

	// no validation rules for To

	// no validation rules for Latest

	// no validation rules for Data

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ExportEventValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Number

	// no validation rules for Hash

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = BlockchainEvent_HeaderValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Number

	// no validation rules for Hash

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ServerStatus_BlockValidationError{}

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