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

package spark_token

import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"sort"
	"strings"
	"time"
	"unicode/utf8"

	"google.golang.org/protobuf/types/known/anypb"

	spark "github.com/lightsparkdev/spark/proto/spark"
)

// 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

	_ = spark.Network(0)
)

// define the regex for a UUID once up-front
var _spark_token_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")

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

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

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

	var errors []error

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

	// no validation rules for PrevTokenTransactionVout

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenOutputToSpendValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenTransferInputValidationError{}

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

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

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

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

	var errors []error

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

	if m.TokenIdentifier != nil {

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenMintInputValidationError{}

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

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

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

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

	var errors []error

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

	if utf8.RuneCountInString(m.GetTokenName()) > 20 {
		err := TokenCreateInputValidationError{
			field:  "TokenName",
			reason: "value length must be at most 20 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetTokenTicker()) > 6 {
		err := TokenCreateInputValidationError{
			field:  "TokenTicker",
			reason: "value length must be at most 6 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetDecimals() > 255 {
		err := TokenCreateInputValidationError{
			field:  "Decimals",
			reason: "value must be less than or equal to 255",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(m.GetMaxSupply()) != 16 {
		err := TokenCreateInputValidationError{
			field:  "MaxSupply",
			reason: "value length must be 16 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for IsFreezable

	if m.CreationEntityPublicKey != nil {

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenCreateInputValidationError{}

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

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

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

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

	var errors []error

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

	if len(m.GetTokenAmount()) != 16 {
		err := TokenOutputValidationError{
			field:  "TokenAmount",
			reason: "value length must be 16 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.Id != nil {

		if err := m._validateUuid(m.GetId()); err != nil {
			err = TokenOutputValidationError{
				field:  "Id",
				reason: "value must be a valid UUID",
				cause:  err,
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	if m.RevocationCommitment != nil {

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

	}

	if m.WithdrawBondSats != nil {
		// no validation rules for WithdrawBondSats
	}

	if m.WithdrawRelativeBlockLocktime != nil {
		// no validation rules for WithdrawRelativeBlockLocktime
	}

	if m.TokenPublicKey != nil {

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

	}

	if m.TokenIdentifier != nil {

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

	}

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

	return nil
}

func (m *TokenOutput) _validateUuid(uuid string) error {
	if matched := _spark_token_uuidPattern.MatchString(uuid); !matched {
		return errors.New("invalid uuid format")
	}

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenOutputValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Version

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

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

	}

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

		if len(item) != 33 {
			err := TokenTransactionValidationError{
				field:  fmt.Sprintf("SparkOperatorIdentityPublicKeys[%v]", idx),
				reason: "value length must be 33 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

	if _, ok := _TokenTransaction_Network_NotInLookup[m.GetNetwork()]; ok {
		err := TokenTransactionValidationError{
			field:  "Network",
			reason: "value must not be in list [UNSPECIFIED]",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

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

	}

	switch v := m.TokenInputs.(type) {
	case *TokenTransaction_MintInput:
		if v == nil {
			err := TokenTransactionValidationError{
				field:  "TokenInputs",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

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

	case *TokenTransaction_TransferInput:
		if v == nil {
			err := TokenTransactionValidationError{
				field:  "TokenInputs",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

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

	case *TokenTransaction_CreateInput:
		if v == nil {
			err := TokenTransactionValidationError{
				field:  "TokenInputs",
				reason: "oneof value cannot be a typed-nil",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

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

	default:
		_ = v // ensures v is used
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenTransactionValidationError{}

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

var _TokenTransaction_Network_NotInLookup = map[spark.Network]struct{}{
	0: {},
}

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

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

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

	var errors []error

	// no validation rules for SparkInvoice

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = InvoiceAttachmentValidationError{}

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

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

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

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

	var errors []error

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

	// no validation rules for InputIndex

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SignatureWithIndexValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = InputTtxoSignaturesPerOperatorValidationError{}

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

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

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

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

	var errors []error

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

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

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

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

	}

	if val := m.GetValidityDurationSeconds(); val < 1 || val > 300 {
		err := StartTransactionRequestValidationError{
			field:  "ValidityDurationSeconds",
			reason: "value must be inside range [1, 300]",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = StartTransactionRequestValidationError{}

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

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

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

func (m *StartTransactionResponse) 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, StartTransactionResponseValidationError{
					field:  "FinalTokenTransaction",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, StartTransactionResponseValidationError{
					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 StartTransactionResponseValidationError{
				field:  "FinalTokenTransaction",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = StartTransactionResponseValidationError{}

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

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

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

func (m *CommitTransactionRequest) 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, CommitTransactionRequestValidationError{
					field:  "FinalTokenTransaction",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, CommitTransactionRequestValidationError{
					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 CommitTransactionRequestValidationError{
				field:  "FinalTokenTransaction",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

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

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

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

	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CommitTransactionRequestValidationError{}

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

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

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

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

	var errors []error

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

		if len(item) != 33 {
			err := CommitProgressValidationError{
				field:  fmt.Sprintf("CommittedOperatorPublicKeys[%v]", idx),
				reason: "value length must be 33 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

		if len(item) != 33 {
			err := CommitProgressValidationError{
				field:  fmt.Sprintf("UncommittedOperatorPublicKeys[%v]", idx),
				reason: "value length must be 33 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CommitProgressValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for CommitStatus

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CommitTransactionResponseValidationError{}

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

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

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

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

	var errors []error

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

		if len(item) != 32 {
			err := QueryTokenMetadataRequestValidationError{
				field:  fmt.Sprintf("TokenIdentifiers[%v]", idx),
				reason: "value length must be 32 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

		if len(item) != 33 {
			err := QueryTokenMetadataRequestValidationError{
				field:  fmt.Sprintf("IssuerPublicKeys[%v]", idx),
				reason: "value length must be 33 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = QueryTokenMetadataRequestValidationError{}

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

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

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

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

	var errors []error

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

	if utf8.RuneCountInString(m.GetTokenName()) > 20 {
		err := TokenMetadataValidationError{
			field:  "TokenName",
			reason: "value length must be at most 20 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if utf8.RuneCountInString(m.GetTokenTicker()) > 6 {
		err := TokenMetadataValidationError{
			field:  "TokenTicker",
			reason: "value length must be at most 6 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetDecimals() > 255 {
		err := TokenMetadataValidationError{
			field:  "Decimals",
			reason: "value must be less than or equal to 255",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if len(m.GetMaxSupply()) != 16 {
		err := TokenMetadataValidationError{
			field:  "MaxSupply",
			reason: "value length must be 16 bytes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	// no validation rules for IsFreezable

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

	if m.CreationEntityPublicKey != nil {

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenMetadataValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = QueryTokenMetadataResponseValidationError{}

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

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

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

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

	var errors []error

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

		if len(item) != 33 {
			err := QueryTokenOutputsRequestValidationError{
				field:  fmt.Sprintf("OwnerPublicKeys[%v]", idx),
				reason: "value length must be 33 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

		if len(item) != 33 {
			err := QueryTokenOutputsRequestValidationError{
				field:  fmt.Sprintf("IssuerPublicKeys[%v]", idx),
				reason: "value length must be 33 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

		if len(item) != 32 {
			err := QueryTokenOutputsRequestValidationError{
				field:  fmt.Sprintf("TokenIdentifiers[%v]", idx),
				reason: "value length must be 32 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	// no validation rules for Network

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = QueryTokenOutputsRequestValidationError{}

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

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

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

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

	var errors []error

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

		if err := m._validateUuid(item); err != nil {
			err = QueryTokenTransactionsRequestValidationError{
				field:  fmt.Sprintf("OutputIds[%v]", idx),
				reason: "value must be a valid UUID",
				cause:  err,
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

		if len(item) != 33 {
			err := QueryTokenTransactionsRequestValidationError{
				field:  fmt.Sprintf("OwnerPublicKeys[%v]", idx),
				reason: "value length must be 33 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

		if len(item) != 33 {
			err := QueryTokenTransactionsRequestValidationError{
				field:  fmt.Sprintf("IssuerPublicKeys[%v]", idx),
				reason: "value length must be 33 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

		if len(item) != 32 {
			err := QueryTokenTransactionsRequestValidationError{
				field:  fmt.Sprintf("TokenIdentifiers[%v]", idx),
				reason: "value length must be 32 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

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

		if len(item) != 32 {
			err := QueryTokenTransactionsRequestValidationError{
				field:  fmt.Sprintf("TokenTransactionHashes[%v]", idx),
				reason: "value length must be 32 bytes",
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	// no validation rules for Limit

	// no validation rules for Offset

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

	return nil
}

func (m *QueryTokenTransactionsRequest) _validateUuid(uuid string) error {
	if matched := _spark_token_uuidPattern.MatchString(uuid); !matched {
		return errors.New("invalid uuid format")
	}

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = QueryTokenTransactionsRequestValidationError{}

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

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

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

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

	var errors []error

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

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

	}

	// no validation rules for Offset

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = QueryTokenTransactionsResponseValidationError{}

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

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

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

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

	var errors []error

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

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

	// no validation rules for PreviousTransactionVout

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = OutputWithPreviousTransactionDataValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = QueryTokenOutputsResponseValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for OutputId

	// no validation rules for RevocationSecret

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SpentTokenOutputMetadataValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenTransactionConfirmationMetadataValidationError{}

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

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

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

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

	var errors []error

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

	// no validation rules for Status

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = TokenTransactionWithStatusValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Version

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

	// no validation rules for IssuerProvidedTimestamp

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

	// no validation rules for ShouldUnfreeze

	if m.TokenPublicKey != nil {

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

	}

	if m.TokenIdentifier != nil {

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = FreezeTokensPayloadValidationError{}

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

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

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

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

	var errors []error

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = FreezeTokensRequestValidationError{}

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

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

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

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

	var errors []error

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

		if err := m._validateUuid(item); err != nil {
			err = FreezeTokensResponseValidationError{
				field:  fmt.Sprintf("ImpactedOutputIds[%v]", idx),
				reason: "value must be a valid UUID",
				cause:  err,
			}
			if !all {
				return err
			}
			errors = append(errors, err)
		}

	}

	// no validation rules for ImpactedTokenAmount

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

	return nil
}

func (m *FreezeTokensResponse) _validateUuid(uuid string) error {
	if matched := _spark_token_uuidPattern.MatchString(uuid); !matched {
		return errors.New("invalid uuid format")
	}

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = FreezeTokensResponseValidationError{}

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