// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: service/dex-finance/account.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 GetAccountRequest 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 *GetAccountRequest) Validate() error {
	return m.validate(false)
}

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

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

	var errors []error

	// no validation rules for UserId

	// no validation rules for CoinId

	// no validation rules for AccountType

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetAccountRequestValidationError{}

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

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

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetAccountReplyValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for UserId

	// no validation rules for CoinId

	// no validation rules for AccountType

	// no validation rules for TradeType

	// no validation rules for Amount

	// no validation rules for StreamId

	// no validation rules for Remark

	// no validation rules for ExtraData

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = AccountRechargeRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for UserId

	// no validation rules for CoinId

	// no validation rules for AccountType

	// no validation rules for AfterAmount

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = AccountRechargeReplyValidationError{}

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