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

package comments

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

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

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

	var errors []error

	if m.GetId() <= 0 {
		err := CommentValidationError{
			field:  "Id",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetUserId() <= 0 {
		err := CommentValidationError{
			field:  "UserId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetSku() <= 0 {
		err := CommentValidationError{
			field:  "Sku",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if l := utf8.RuneCountInString(m.GetText()); l < 1 || l > 255 {
		err := CommentValidationError{
			field:  "Text",
			reason: "value length must be between 1 and 255 runes, inclusive",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CommentValidationError{}

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

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

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

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

	var errors []error

	if m.GetUserId() <= 0 {
		err := CreateCommentRequestValidationError{
			field:  "UserId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetSku() <= 0 {
		err := CreateCommentRequestValidationError{
			field:  "Sku",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if l := utf8.RuneCountInString(m.GetComment()); l < 1 || l > 255 {
		err := CreateCommentRequestValidationError{
			field:  "Comment",
			reason: "value length must be between 1 and 255 runes, inclusive",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreateCommentRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = CreateCommentResponseValidationError{}

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

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

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

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

	var errors []error

	if m.GetId() <= 0 {
		err := GetCommentRequestValidationError{
			field:  "Id",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetCommentRequestValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetCommentResponseValidationError{}

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

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

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

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

	var errors []error

	if m.GetUserId() <= 0 {
		err := EditCommentRequestValidationError{
			field:  "UserId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if m.GetCommentId() <= 0 {
		err := EditCommentRequestValidationError{
			field:  "CommentId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if l := utf8.RuneCountInString(m.GetNewComment()); l < 1 || l > 255 {
		err := EditCommentRequestValidationError{
			field:  "NewComment",
			reason: "value length must be between 1 and 255 runes, inclusive",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = EditCommentRequestValidationError{}

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

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

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

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

	var errors []error

	if m.GetSku() <= 0 {
		err := ListBySkuRequestValidationError{
			field:  "Sku",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListBySkuRequestValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListBySkuResponseValidationError{}

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

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

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

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

	var errors []error

	if m.GetUserId() <= 0 {
		err := ListByUserRequestValidationError{
			field:  "UserId",
			reason: "value must be greater than 0",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListByUserRequestValidationError{}

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

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

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

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

	var errors []error

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

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

	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListByUserResponseValidationError{}

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