func (e PacketBrokerNetworkIdentifierValidationError) ErrorName() string {
	return "PacketBrokerNetworkIdentifierValidationError"
}
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 _packetbrokeragent_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 *PacketBrokerGateway) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = PacketBrokerGatewayFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "ids":
			if m.GetIds() == nil {
				return PacketBrokerGatewayValidationError{
					field:  "ids",
					reason: "value is required",
				}
			}
			if v, ok := interface{}(m.GetIds()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return PacketBrokerGatewayValidationError{
						field:  "ids",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "contact_info":
			if len(m.GetContactInfo()) > 10 {
				return PacketBrokerGatewayValidationError{
					field:  "contact_info",
					reason: "value must contain no more than 10 item(s)",
				}
			}
			for idx, item := range m.GetContactInfo() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return PacketBrokerGatewayValidationError{
							field:  fmt.Sprintf("contact_info[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		case "antennas":
			if len(m.GetAntennas()) > 8 {
				return PacketBrokerGatewayValidationError{
					field:  "antennas",
					reason: "value must contain no more than 8 item(s)",
				}
			}
			for idx, item := range m.GetAntennas() {
				_, _ = idx, item
				if v, ok := interface{}(item).(interface{ ValidateFields(...string) error }); ok {
					if err := v.ValidateFields(subs...); err != nil {
						return PacketBrokerGatewayValidationError{
							field:  fmt.Sprintf("antennas[%v]", idx),
							reason: "embedded message failed validation",
							cause:  err,
						}
					}
				}
			}
		case "status_public":
		case "location_public":
		case "frequency_plan_ids":
			if len(m.GetFrequencyPlanIds()) > 8 {
				return PacketBrokerGatewayValidationError{
					field:  "frequency_plan_ids",
					reason: "value must contain no more than 8 item(s)",
				}
			}
			for idx, item := range m.GetFrequencyPlanIds() {
				_, _ = idx, item
				if utf8.RuneCountInString(item) > 64 {
					return PacketBrokerGatewayValidationError{
						field:  fmt.Sprintf("frequency_plan_ids[%v]", idx),
						reason: "value length must be at most 64 runes",
					}
				}
			}
		case "update_location_from_status":
		case "online":
		case "rx_rate":
			if v, ok := interface{}(m.GetRxRate()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return PacketBrokerGatewayValidationError{
						field:  "rx_rate",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "tx_rate":
			if v, ok := interface{}(m.GetTxRate()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return PacketBrokerGatewayValidationError{
						field:  "tx_rate",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return PacketBrokerGatewayValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type PacketBrokerGatewayValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e PacketBrokerGatewayValidationError) Field() string { return e.field }
func (e PacketBrokerGatewayValidationError) Reason() string { return e.reason }
func (e PacketBrokerGatewayValidationError) Cause() error { return e.cause }
func (e PacketBrokerGatewayValidationError) Key() bool { return e.key }
func (e PacketBrokerGatewayValidationError) ErrorName() string {
	return "PacketBrokerGatewayValidationError"
}
func (e PacketBrokerGatewayValidationError) 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 %sPacketBrokerGateway.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = PacketBrokerGatewayValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = PacketBrokerGatewayValidationError{}
func (m *UpdatePacketBrokerGatewayRequest) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = UpdatePacketBrokerGatewayRequestFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "gateway":
			if m.GetGateway() == nil {
				return UpdatePacketBrokerGatewayRequestValidationError{
					field:  "gateway",
					reason: "value is required",
				}
			}
			if v, ok := interface{}(m.GetGateway()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return UpdatePacketBrokerGatewayRequestValidationError{
						field:  "gateway",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		case "field_mask":
			if v, ok := interface{}(m.GetFieldMask()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return UpdatePacketBrokerGatewayRequestValidationError{
						field:  "field_mask",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return UpdatePacketBrokerGatewayRequestValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type UpdatePacketBrokerGatewayRequestValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e UpdatePacketBrokerGatewayRequestValidationError) Field() string { return e.field }
func (e UpdatePacketBrokerGatewayRequestValidationError) Reason() string { return e.reason }
func (e UpdatePacketBrokerGatewayRequestValidationError) Cause() error { return e.cause }
func (e UpdatePacketBrokerGatewayRequestValidationError) Key() bool { return e.key }
func (e UpdatePacketBrokerGatewayRequestValidationError) ErrorName() string {
	return "UpdatePacketBrokerGatewayRequestValidationError"
}
func (e UpdatePacketBrokerGatewayRequestValidationError) 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 %sUpdatePacketBrokerGatewayRequest.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = UpdatePacketBrokerGatewayRequestValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = UpdatePacketBrokerGatewayRequestValidationError{}
func (m *UpdatePacketBrokerGatewayResponse) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = UpdatePacketBrokerGatewayResponseFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "online_ttl":
			if v, ok := interface{}(m.GetOnlineTtl()).(interface{ ValidateFields(...string) error }); ok {
				if err := v.ValidateFields(subs...); err != nil {
					return UpdatePacketBrokerGatewayResponseValidationError{
						field:  "online_ttl",
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		default:
			return UpdatePacketBrokerGatewayResponseValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type UpdatePacketBrokerGatewayResponseValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e UpdatePacketBrokerGatewayResponseValidationError) Field() string { return e.field }
func (e UpdatePacketBrokerGatewayResponseValidationError) Reason() string { return e.reason }
func (e UpdatePacketBrokerGatewayResponseValidationError) Cause() error { return e.cause }
func (e UpdatePacketBrokerGatewayResponseValidationError) Key() bool { return e.key }
func (e UpdatePacketBrokerGatewayResponseValidationError) ErrorName() string {
	return "UpdatePacketBrokerGatewayResponseValidationError"
}
func (e UpdatePacketBrokerGatewayResponseValidationError) 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 %sUpdatePacketBrokerGatewayResponse.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
var _ error = UpdatePacketBrokerGatewayResponseValidationError{}
var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = UpdatePacketBrokerGatewayResponseValidationError{}
func (m *PacketBrokerNetworkIdentifier) ValidateFields(paths ...string) error {
	if m == nil {
		return nil
	}
	if len(paths) == 0 {
		paths = PacketBrokerNetworkIdentifierFieldPathsNested
	}
	for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
		_ = subs
		switch name {
		case "net_id":
		case "tenant_id":
			if utf8.RuneCountInString(m.GetTenantId()) > 36 {
				return PacketBrokerNetworkIdentifierValidationError{
					field:  "tenant_id",
					reason: "value length must be at most 36 runes",
				}
			}
			if !_PacketBrokerNetworkIdentifier_TenantId_Pattern.MatchString(m.GetTenantId()) {
				return PacketBrokerNetworkIdentifierValidationError{
					field:  "tenant_id",
					reason: "value does not match regex pattern \"^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$\"",
				}
			}
		default:
			return PacketBrokerNetworkIdentifierValidationError{
				field:  name,
				reason: "invalid field path",
			}
		}
	}
	return nil
}
type PacketBrokerNetworkIdentifierValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}
func (e PacketBrokerNetworkIdentifierValidationError) Field() string { return e.field }
func (e PacketBrokerNetworkIdentifierValidationError) Reason() string { return e.reason }
func (e PacketBrokerNetworkIdentifierValidationError) Cause() error { return e.cause }
func (e PacketBrokerNetworkIdentifierValidationError) Key() bool { return e.key }