// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: service/dex-finance/coin.proto

package dex_finance

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

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

// ensure the imports are used
var (
	_ = bytes.MinRead
	_ = errors.New("")
	_ = fmt.Print
	_ = utf8.UTFMax
	_ = (*regexp.Regexp)(nil)
	_ = (*strings.Reader)(nil)
	_ = net.IPv4len
	_ = time.Duration(0)
	_ = (*url.URL)(nil)
	_ = (*mail.Address)(nil)
	_ = anypb.Any{}
	_ = sort.Sort
)

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

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

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

	var errors []error

	// no validation rules for Id

	// no validation rules for Name

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = GetCoinRequestValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

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

var _ error = GetCoinReplyValidationError{}

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