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

package v1

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

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

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DeleteNotificationRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = DeleteNotificationReplyValidationError{}

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

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

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

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

	var errors []error

	if utf8.RuneCountInString(m.GetId()) < 1 {
		err := GetNotificationRequestValidationError{
			field:  "Id",
			reason: "value length must be at least 1 runes",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = GetNotificationRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ReadNotificationRequestValidationError{}

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

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

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

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

	var errors []error

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = NotificationFilterValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for AfterPageToken

	// no validation rules for BeforePageToken

	// no validation rules for PageSize

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListNotificationRequestValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for TotalSize

	// no validation rules for FilterSize

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

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

	}

	// no validation rules for UnreadSize

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

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

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = ListNotificationReplyValidationError{}

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

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

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

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

	var errors []error

	// no validation rules for Id

	// no validation rules for TenantId

	// no validation rules for Group

	// no validation rules for Title

	// no validation rules for Desc

	// no validation rules for Image

	// no validation rules for Link

	// no validation rules for Source

	// no validation rules for UserId

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

	// no validation rules for Level

	// no validation rules for HasRead

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

	return nil
}

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

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

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

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

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

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

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

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

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

var _ error = NotificationValidationError{}

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