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

package common

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

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

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

	var errors []error

	// no validation rules for Tags

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = BaseReqValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Tags

	// no validation rules for ErrCode

	// no validation rules for ErrMsg

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = BaseRespValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Page

	// no validation rules for PageSize

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = PagerValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for OrderBy

	// no validation rules for Sort

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = SorterValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = EmptyResponseValidationError{}

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