func (e ListEndDeviceBrandsRequestValidationError) 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 %sListEndDeviceBrandsRequest.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
Error satisfies the builtin error interface
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 _devicerepository_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 *EndDeviceBrand) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = EndDeviceBrandFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "brand_id":
			if utf8.RuneCountInString(m.GetBrandId()) > 36 {
				return EndDeviceBrandValidationError{
					field:  "brand_id",
					reason: "value length must be at most 36 runes",
				}
			}
			if !_EndDeviceBrand_BrandId_Pattern.MatchString(m.GetBrandId()) {
				return EndDeviceBrandValidationError{
					field:  "brand_id",
					reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"",
				}
			}
		case "name":
		case "private_enterprise_number":
		case "organization_unique_identifiers":
			for idx, item := range m.GetOrganizationUniqueIdentifiers() {
				_, _ = idx, item
				if !_EndDeviceBrand_OrganizationUniqueIdentifiers_Pattern.MatchString(item) {
					return EndDeviceBrandValidationError{
						field:  fmt.Sprintf("organization_unique_identifiers[%v]", idx),
						reason: "value does not match regex pattern \"[0-9A-F]{6}\"",
					}
				}
			}
		case "lora_alliance_vendor_id":
		case "website":
			if m.GetWebsite() != "" {
				if uri, err := url.Parse(m.GetWebsite()); err != nil {
					return EndDeviceBrandValidationError{
						field:  "website",
						reason: "value must be a valid URI",
						cause:  err,
					}
				} else if !uri.IsAbs() {
					return EndDeviceBrandValidationError{
						field:  "website",
						reason: "value must be absolute",
					}
				}
			}
		case "email":
			if m.GetEmail() != "" {
				if err := m._validateEmail(m.GetEmail()); err != nil {
					return EndDeviceBrandValidationError{
						field:  "email",
						reason: "value must be a valid email address",
						cause:  err,
					}
				}
			}
		case "logo":
			if !_EndDeviceBrand_Logo_Pattern.MatchString(m.GetLogo()) {
				return EndDeviceBrandValidationError{
					field:  "logo",
					reason: "value does not match regex pattern \"^$|^(([a-z0-9-]+\\\\/)+)?([a-z0-9_-]+\\\\.)+(png|svg)$\"",
				}
			}
		default:
			return EndDeviceBrandValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
func (m *EndDeviceBrand) _validateHostname(host string) error {
	s := strings.ToLower(strings.TrimSuffix(host, "."))
	if len(host) > 253 {
		return errors.New("hostname cannot exceed 253 characters")
	}
	for _, part := range strings.Split(s, ".") {
		if l := len(part); l == 0 || l > 63 {
			return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
		}
		if part[0] == '-' {
			return errors.New("hostname parts cannot begin with hyphens")
		}
		if part[len(part)-1] == '-' {
			return errors.New("hostname parts cannot end with hyphens")
		}
		for _, r := range part {
			if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
				return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
			}
		}
	}
	return nil
}
func (m *EndDeviceBrand) _validateEmail(addr string) error {
	a, err := mail.ParseAddress(addr)
	if err != nil {
		return err
	}
	addr = a.Address
	if len(addr) > 254 {
		return errors.New("email addresses cannot exceed 254 characters")
	}
	parts := strings.SplitN(addr, "@", 2)
	if len(parts[0]) > 64 {
		return errors.New("email address local phrase cannot exceed 64 characters")
	}
	return m._validateHostname(parts[1])
}
type EndDeviceBrandValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e EndDeviceBrandValidationError) Field() string { return e.field }
func (e EndDeviceBrandValidationError) Reason() string { return e.reason }
func (e EndDeviceBrandValidationError) Cause() error { return e.cause }
func (e EndDeviceBrandValidationError) Key() bool { return e.key }
func (e EndDeviceBrandValidationError) ErrorName() string { return "EndDeviceBrandValidationError" }
func (e EndDeviceBrandValidationError) 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 %sEndDeviceBrand.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = EndDeviceBrandValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = EndDeviceBrandValidationError{}
var _EndDeviceBrand_BrandId_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$")
var _EndDeviceBrand_OrganizationUniqueIdentifiers_Pattern = regexp.MustCompile("[0-9A-F]{6}")
var _EndDeviceBrand_Logo_Pattern = regexp.MustCompile("^$|^(([a-z0-9-]+\\/)+)?([a-z0-9_-]+\\.)+(png|svg)$")
func (m *EndDeviceModel) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = EndDeviceModelFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "brand_id":
			if utf8.RuneCountInString(m.GetBrandId()) > 36 {
				return EndDeviceModelValidationError{
					field:  "brand_id",
					reason: "value length must be at most 36 runes",
				}
			}
			if !_EndDeviceModel_BrandId_Pattern.MatchString(m.GetBrandId()) {
				return EndDeviceModelValidationError{
					field:  "brand_id",
					reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"",
				}
			}
		case "model_id":
			if utf8.RuneCountInString(m.GetModelId()) > 36 {
				return EndDeviceModelValidationError{
					field:  "model_id",
					reason: "value length must be at most 36 runes",
				}
			}
			if !_EndDeviceModel_ModelId_Pattern.MatchString(m.GetModelId()) {
				return EndDeviceModelValidationError{
					field:  "model_id",
					reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"",
				}
			}
		case "name":
		case "description":
		case "hardware_versions":
			for idx, item := range m.GetHardwareVersions() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return EndDeviceModelValidationError{
							field:  fmt.Sprintf("hardware_versions[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		case "firmware_versions":
			for idx, item := range m.GetFirmwareVersions() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return EndDeviceModelValidationError{
							field:  fmt.Sprintf("firmware_versions[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		case "sensors":
			_EndDeviceModel_Sensors_Unique := make(map[string]struct{}, len(m.GetSensors()))
			for idx, item := range m.GetSensors() {
				_, _ = idx, item
				if _, exists := _EndDeviceModel_Sensors_Unique[item]; exists {
					return EndDeviceModelValidationError{
						field:  fmt.Sprintf("sensors[%v]", idx),
						reason: "repeated value must contain unique items",
					}
				} else {
					_EndDeviceModel_Sensors_Unique[item] = struct{}{}
				}
			}
		case "dimensions":
			if v, ok := interface{}(m.GetDimensions()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceModelValidationError{
						field:  "dimensions",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "weight":
			if v, ok := interface{}(m.GetWeight()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceModelValidationError{
						field:  "weight",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "battery":
			if v, ok := interface{}(m.GetBattery()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceModelValidationError{
						field:  "battery",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "operating_conditions":
			if v, ok := interface{}(m.GetOperatingConditions()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceModelValidationError{
						field:  "operating_conditions",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "ip_code":
		case "key_provisioning":
			_EndDeviceModel_KeyProvisioning_Unique := make(map[KeyProvisioning]struct{}, len(m.GetKeyProvisioning()))
			for idx, item := range m.GetKeyProvisioning() {
				_, _ = idx, item
				if _, exists := _EndDeviceModel_KeyProvisioning_Unique[item]; exists {
					return EndDeviceModelValidationError{
						field:  fmt.Sprintf("key_provisioning[%v]", idx),
						reason: "repeated value must contain unique items",
					}
				} else {
					_EndDeviceModel_KeyProvisioning_Unique[item] = struct{}{}
				}
				if _, ok := KeyProvisioning_name[int32(item)]; !ok {
					return EndDeviceModelValidationError{
						field:  fmt.Sprintf("key_provisioning[%v]", idx),
						reason: "value must be one of the defined enum values",
					}
				}
			}
		case "key_security":
			if _, ok := KeySecurity_name[int32(m.GetKeySecurity())]; !ok {
				return EndDeviceModelValidationError{
					field:  "key_security",
					reason: "value must be one of the defined enum values",
				}
			}
		case "photos":
			if v, ok := interface{}(m.GetPhotos()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceModelValidationError{
						field:  "photos",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "videos":
			if v, ok := interface{}(m.GetVideos()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceModelValidationError{
						field:  "videos",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "product_url":
			if m.GetProductUrl() != "" {
				if uri, err := url.Parse(m.GetProductUrl()); err != nil {
					return EndDeviceModelValidationError{
						field:  "product_url",
						reason: "value must be a valid URI",
						cause:  err,
					}
				} else if !uri.IsAbs() {
					return EndDeviceModelValidationError{
						field:  "product_url",
						reason: "value must be absolute",
					}
				}
			}
		case "datasheet_url":
			if m.GetDatasheetUrl() != "" {
				if uri, err := url.Parse(m.GetDatasheetUrl()); err != nil {
					return EndDeviceModelValidationError{
						field:  "datasheet_url",
						reason: "value must be a valid URI",
						cause:  err,
					}
				} else if !uri.IsAbs() {
					return EndDeviceModelValidationError{
						field:  "datasheet_url",
						reason: "value must be absolute",
					}
				}
			}
		case "resellers":
			for idx, item := range m.GetResellers() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return EndDeviceModelValidationError{
							field:  fmt.Sprintf("resellers[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		case "compliances":
			if v, ok := interface{}(m.GetCompliances()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return EndDeviceModelValidationError{
						field:  "compliances",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "additional_radios":
			_EndDeviceModel_AdditionalRadios_Unique := make(map[string]struct{}, len(m.GetAdditionalRadios()))
			for idx, item := range m.GetAdditionalRadios() {
				_, _ = idx, item
				if _, exists := _EndDeviceModel_AdditionalRadios_Unique[item]; exists {
					return EndDeviceModelValidationError{
						field:  fmt.Sprintf("additional_radios[%v]", idx),
						reason: "repeated value must contain unique items",
					}
				} else {
					_EndDeviceModel_AdditionalRadios_Unique[item] = struct{}{}
				}
			}
		default:
			return EndDeviceModelValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type EndDeviceModelValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e EndDeviceModelValidationError) Field() string { return e.field }
func (e EndDeviceModelValidationError) Reason() string { return e.reason }
func (e EndDeviceModelValidationError) Cause() error { return e.cause }
func (e EndDeviceModelValidationError) Key() bool { return e.key }
func (e EndDeviceModelValidationError) ErrorName() string { return "EndDeviceModelValidationError" }
func (e EndDeviceModelValidationError) 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 %sEndDeviceModel.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = EndDeviceModelValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = EndDeviceModelValidationError{}
var _EndDeviceModel_BrandId_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$")
var _EndDeviceModel_ModelId_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$")
func (m *GetEndDeviceBrandRequest) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = GetEndDeviceBrandRequestFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "application_ids":
			if m.GetApplicationIds() == nil {
				return GetEndDeviceBrandRequestValidationError{
					field:  "application_ids",
					reason: "value is required",
				}
			}
			if v, ok := interface{}(m.GetApplicationIds()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return GetEndDeviceBrandRequestValidationError{
						field:  "application_ids",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "brand_id":
			if utf8.RuneCountInString(m.GetBrandId()) > 36 {
				return GetEndDeviceBrandRequestValidationError{
					field:  "brand_id",
					reason: "value length must be at most 36 runes",
				}
			}
			if !_GetEndDeviceBrandRequest_BrandId_Pattern.MatchString(m.GetBrandId()) {
				return GetEndDeviceBrandRequestValidationError{
					field:  "brand_id",
					reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$\"",
				}
			}
		case "field_mask":
			if v, ok := interface{}(m.GetFieldMask()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return GetEndDeviceBrandRequestValidationError{
						field:  "field_mask",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return GetEndDeviceBrandRequestValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type GetEndDeviceBrandRequestValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e GetEndDeviceBrandRequestValidationError) Field() string { return e.field }
func (e GetEndDeviceBrandRequestValidationError) Reason() string { return e.reason }
func (e GetEndDeviceBrandRequestValidationError) Cause() error { return e.cause }
func (e GetEndDeviceBrandRequestValidationError) Key() bool { return e.key }
func (e GetEndDeviceBrandRequestValidationError) ErrorName() string {
	return "GetEndDeviceBrandRequestValidationError"
}
func (e GetEndDeviceBrandRequestValidationError) 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 %sGetEndDeviceBrandRequest.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = GetEndDeviceBrandRequestValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = GetEndDeviceBrandRequestValidationError{}
var _GetEndDeviceBrandRequest_BrandId_Pattern = regexp.MustCompile("^[a-z0-9](?:[-]?[a-z0-9]){2,}$")
func (m *ListEndDeviceBrandsRequest) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = ListEndDeviceBrandsRequestFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "application_ids":
			if m.GetApplicationIds() == nil {
				return ListEndDeviceBrandsRequestValidationError{
					field:  "application_ids",
					reason: "value is required",
				}
			}
			if v, ok := interface{}(m.GetApplicationIds()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ListEndDeviceBrandsRequestValidationError{
						field:  "application_ids",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "limit":
			if m.GetLimit() > 1000 {
				return ListEndDeviceBrandsRequestValidationError{
					field:  "limit",
					reason: "value must be less than or equal to 1000",
				}
			}
		case "page":
		case "order_by":
			if _, ok := _ListEndDeviceBrandsRequest_OrderBy_InLookup[m.GetOrderBy()]; !ok {
				return ListEndDeviceBrandsRequestValidationError{
					field:  "order_by",
					reason: "value must be in list [ brand_id -brand_id name -name]",
				}
			}
		case "search":
			if utf8.RuneCountInString(m.GetSearch()) > 100 {
				return ListEndDeviceBrandsRequestValidationError{
					field:  "search",
					reason: "value length must be at most 100 runes",
				}
			}
		case "field_mask":
			if v, ok := interface{}(m.GetFieldMask()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return ListEndDeviceBrandsRequestValidationError{
						field:  "field_mask",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return ListEndDeviceBrandsRequestValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type ListEndDeviceBrandsRequestValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e ListEndDeviceBrandsRequestValidationError) Field() string { return e.field }
func (e ListEndDeviceBrandsRequestValidationError) Reason() string { return e.reason }
func (e ListEndDeviceBrandsRequestValidationError) Cause() error { return e.cause }
func (e ListEndDeviceBrandsRequestValidationError) Key() bool { return e.key }
func (e ListEndDeviceBrandsRequestValidationError) ErrorName() string {
	return "ListEndDeviceBrandsRequestValidationError"
}