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

package spark_tree

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

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

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

	var errors []error

	// no validation rules for OwnerIdentityPublicKey

	// no validation rules for Network

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m GetLeafDenominationCountsRequestMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GetLeafDenominationCountsRequestMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = GetLeafDenominationCountsRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Counts

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m GetLeafDenominationCountsResponseMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m GetLeafDenominationCountsResponseMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = GetLeafDenominationCountsResponseValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m FetchPolarityScoreRequestMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m FetchPolarityScoreRequestMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = FetchPolarityScoreRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for LeafId

	// no validation rules for PublicKey

	// no validation rules for Score

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

	return nil
}

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

// Error returns a concatenation of all the error messages it wraps.
func (m PolarityScoreMultiError) Error() string {
	msgs := make([]string, 0, len(m))
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m PolarityScoreMultiError) AllErrors() []error { return m }

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

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

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

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

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

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

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

var _ error = PolarityScoreValidationError{}

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