func (e SearchClientsRequestValidationError) ErrorName() string {
	return "SearchClientsRequestValidationError"
}
ErrorName returns error name.
package ttnpb
import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"strings"
	"time"
	"unicode/utf8"
	"github.com/gogo/protobuf/types"
)
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)
	_ = types.DynamicAny{}
)
var _search_services_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
func (m *SearchApplicationsRequest) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = SearchApplicationsRequestFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "id_contains":
			if utf8.RuneCountInString(m.GetIdContains()) > 50 {
				return SearchApplicationsRequestValidationError{
					field:  "id_contains",
					reason: "value length must be at most 50 runes",
				}
			}
		case "name_contains":
			if utf8.RuneCountInString(m.GetNameContains()) > 50 {
				return SearchApplicationsRequestValidationError{
					field:  "name_contains",
					reason: "value length must be at most 50 runes",
				}
			}
		case "description_contains":
			if utf8.RuneCountInString(m.GetDescriptionContains()) > 50 {
				return SearchApplicationsRequestValidationError{
					field:  "description_contains",
					reason: "value length must be at most 50 runes",
				}
			}
		case "attributes_contain":
			if len(m.GetAttributesContain()) > 10 {
				return SearchApplicationsRequestValidationError{
					field:  "attributes_contain",
					reason: "value must contain no more than 10 pair(s)",
				}
			}
			for key, val := range m.GetAttributesContain() {
				_ = val
				if utf8.RuneCountInString(key) > 36 {
					return SearchApplicationsRequestValidationError{
						field:  fmt.Sprintf("attributes_contain[%v]", key),
						reason: "value length must be at most 36 runes",
					}
				}
				if !_SearchApplicationsRequest_AttributesContain_Pattern.MatchString(key) {
					return SearchApplicationsRequestValidationError{
						field:  fmt.Sprintf("attributes_contain[%v]", key),
						reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"",
					}
				}
				if utf8.RuneCountInString(val) > 50 {
					return SearchApplicationsRequestValidationError{
						field:  fmt.Sprintf("attributes_contain[%v]", key),
						reason: "value length must be at most 50 runes",
					}
				}
			}
		case "field_mask":
			if v, ok := interface{}(m.GetFieldMask()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return SearchApplicationsRequestValidationError{
						field:  "field_mask",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "order":
			if _, ok := _SearchApplicationsRequest_Order_InLookup[m.GetOrder()]; !ok {
				return SearchApplicationsRequestValidationError{
					field:  "order",
					reason: "value must be in list [ application_id -application_id name -name created_at -created_at]",
				}
			}
		case "limit":
			if m.GetLimit() > 1000 {
				return SearchApplicationsRequestValidationError{
					field:  "limit",
					reason: "value must be less than or equal to 1000",
				}
			}
		case "page":
		case "deleted":
		default:
			return SearchApplicationsRequestValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type SearchApplicationsRequestValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e SearchApplicationsRequestValidationError) Field() string { return e.field }
func (e SearchApplicationsRequestValidationError) Reason() string { return e.reason }
func (e SearchApplicationsRequestValidationError) Cause() error { return e.cause }
func (e SearchApplicationsRequestValidationError) Key() bool { return e.key }
func (e SearchApplicationsRequestValidationError) ErrorName() string {
	return "SearchApplicationsRequestValidationError"
}
func (e SearchApplicationsRequestValidationError) 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 %sSearchApplicationsRequest.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = SearchApplicationsRequestValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = SearchApplicationsRequestValidationError{}
var _SearchApplicationsRequest_AttributesContain_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$")
var _SearchApplicationsRequest_Order_InLookup = map[string]struct{}{
	"":                {},
	"application_id":  {},
	"-application_id": {},
	"name":            {},
	"-name":           {},
	"created_at":      {},
	"-created_at":     {},
}
func (m *SearchClientsRequest) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = SearchClientsRequestFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "id_contains":
			if utf8.RuneCountInString(m.GetIdContains()) > 50 {
				return SearchClientsRequestValidationError{
					field:  "id_contains",
					reason: "value length must be at most 50 runes",
				}
			}
		case "name_contains":
			if utf8.RuneCountInString(m.GetNameContains()) > 50 {
				return SearchClientsRequestValidationError{
					field:  "name_contains",
					reason: "value length must be at most 50 runes",
				}
			}
		case "description_contains":
			if utf8.RuneCountInString(m.GetDescriptionContains()) > 50 {
				return SearchClientsRequestValidationError{
					field:  "description_contains",
					reason: "value length must be at most 50 runes",
				}
			}
		case "attributes_contain":
			if len(m.GetAttributesContain()) > 10 {
				return SearchClientsRequestValidationError{
					field:  "attributes_contain",
					reason: "value must contain no more than 10 pair(s)",
				}
			}
			for key, val := range m.GetAttributesContain() {
				_ = val
				if utf8.RuneCountInString(key) > 36 {
					return SearchClientsRequestValidationError{
						field:  fmt.Sprintf("attributes_contain[%v]", key),
						reason: "value length must be at most 36 runes",
					}
				}
				if !_SearchClientsRequest_AttributesContain_Pattern.MatchString(key) {
					return SearchClientsRequestValidationError{
						field:  fmt.Sprintf("attributes_contain[%v]", key),
						reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"",
					}
				}
				if utf8.RuneCountInString(val) > 50 {
					return SearchClientsRequestValidationError{
						field:  fmt.Sprintf("attributes_contain[%v]", key),
						reason: "value length must be at most 50 runes",
					}
				}
			}
		case "state":
			_SearchClientsRequest_State_Unique := make(map[State]struct{}, len(m.GetState()))
			for idx, item := range m.GetState() {
				_, _ = idx, item
				if _, exists := _SearchClientsRequest_State_Unique[item]; exists {
					return SearchClientsRequestValidationError{
						field:  fmt.Sprintf("state[%v]", idx),
						reason: "repeated value must contain unique items",
					}
				} else {
					_SearchClientsRequest_State_Unique[item] = struct{}{}
				}
				if _, ok := State_name[int32(item)]; !ok {
					return SearchClientsRequestValidationError{
						field:  fmt.Sprintf("state[%v]", idx),
						reason: "value must be one of the defined enum values",
					}
				}
			}
		case "field_mask":
			if v, ok := interface{}(m.GetFieldMask()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return SearchClientsRequestValidationError{
						field:  "field_mask",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "order":
			if _, ok := _SearchClientsRequest_Order_InLookup[m.GetOrder()]; !ok {
				return SearchClientsRequestValidationError{
					field:  "order",
					reason: "value must be in list [ client_id -client_id name -name created_at -created_at]",
				}
			}
		case "limit":
			if m.GetLimit() > 1000 {
				return SearchClientsRequestValidationError{
					field:  "limit",
					reason: "value must be less than or equal to 1000",
				}
			}
		case "page":
		case "deleted":
		default:
			return SearchClientsRequestValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type SearchClientsRequestValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e SearchClientsRequestValidationError) Field() string { return e.field }
func (e SearchClientsRequestValidationError) Reason() string { return e.reason }
func (e SearchClientsRequestValidationError) Cause() error { return e.cause }
func (e SearchClientsRequestValidationError) Key() bool { return e.key }