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

package spark_token_internal

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

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

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

	var errors []error

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

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

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

	}

	// no validation rules for CoordinatorPublicKey

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PrepareTransactionRequestValidationError{}

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

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

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

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

	var errors []error

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PrepareTransactionResponseValidationError{}

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

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

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

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

	var errors []error

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

	if len(m.GetFinalTokenTransactionHash()) != 32 {
		err := SignTokenTransactionFromCoordinationRequestValidationError{
			field:  "FinalTokenTransactionHash",
			reason: "value length must be 32 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	if len(m.GetOwnerIdentityPublicKey()) != 33 {
		err := SignTokenTransactionFromCoordinationRequestValidationError{
			field:  "OwnerIdentityPublicKey",
			reason: "value length must be 33 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SignTokenTransactionFromCoordinationRequestValidationError{}

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

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

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

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

	var errors []error

	if l := len(m.GetSparkOperatorSignature()); l < 64 || l > 73 {
		err := SignTokenTransactionFromCoordinationResponseValidationError{
			field:  "SparkOperatorSignature",
			reason: "value length must be between 64 and 73 bytes, inclusive",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SignTokenTransactionFromCoordinationResponseValidationError{}

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

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

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

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

	var errors []error

	if len(m.GetOperatorIdentityPublicKey()) != 33 {
		err := OperatorTransactionSignatureValidationError{
			field:  "OperatorIdentityPublicKey",
			reason: "value length must be 33 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if l := len(m.GetSignature()); l < 64 || l > 73 {
		err := OperatorTransactionSignatureValidationError{
			field:  "Signature",
			reason: "value length must be between 64 and 73 bytes, inclusive",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = OperatorTransactionSignatureValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for InputTtxoId

	// no validation rules for SecretShare

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = RevocationSecretShareValidationError{}

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

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

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

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

	var errors []error

	if len(m.GetOperatorIdentityPublicKey()) != 33 {
		err := OperatorRevocationSharesValidationError{
			field:  "OperatorIdentityPublicKey",
			reason: "value length must be 33 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = OperatorRevocationSharesValidationError{}

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

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

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

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

	var errors []error

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

	if len(m.GetFinalTokenTransactionHash()) != 32 {
		err := ExchangeRevocationSecretsSharesRequestValidationError{
			field:  "FinalTokenTransactionHash",
			reason: "value length must be 32 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	}

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

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

	}

	if len(m.GetOperatorIdentityPublicKey()) != 33 {
		err := ExchangeRevocationSecretsSharesRequestValidationError{
			field:  "OperatorIdentityPublicKey",
			reason: "value length must be 33 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ExchangeRevocationSecretsSharesRequestValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ExchangeRevocationSecretsSharesResponseValidationError{}

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