// UnmarshalText tries to decode ExceptionType from a byte slice
// containing its name.
//
//   var v ExceptionType
//   err := v.UnmarshalText([]byte("UNKNOWN"))
969155
func (v *ExceptionType) UnmarshalText(value []byte) error {
	switch s := string(value); s {
	case "UNKNOWN":
		*v = ExceptionTypeUnknown
		return nil
	case "UNKNOWN_METHOD":
		*v = ExceptionTypeUnknownMethod
		return nil
	case "INVALID_MESSAGE_TYPE":
		*v = ExceptionTypeInvalidMessageType
		return nil
	case "WRONG_METHOD_NAME":
		*v = ExceptionTypeWrongMethodName
		return nil
	case "BAD_SEQUENCE_ID":
		*v = ExceptionTypeBadSequenceID
		return nil
	case "MISSING_RESULT":
		*v = ExceptionTypeMissingResult
		return nil
	case "INTERNAL_ERROR":
		*v = ExceptionTypeInternalError
		return nil
	case "PROTOCOL_ERROR":
		*v = ExceptionTypeProtocolError
		return nil
	case "INVALID_TRANSFORM":
		*v = ExceptionTypeInvalidTransform
		return nil
	case "INVALID_PROTOCOL":
		*v = ExceptionTypeInvalidProtocol
		return nil
	case "UNSUPPORTED_CLIENT_TYPE":
		*v = ExceptionTypeUnsupportedClientType
		return nil
	default:
		val, err := strconv.ParseInt(s, 10, 32)
		if err != nil {
			return fmt.Errorf("unknown enum value %q for %q: %v", s, "ExceptionType", err)
		}
		*v = ExceptionType(val)
		return nil
	}
}
877331
func (t *Time) UnmarshalText(data []byte) (err error) {
	timeFormat := azureUtcFormat
	match, err := regexp.Match(tzOffsetRegex, data)
	if err != nil {
		return err
	} else if match {
		timeFormat = rfc3339
	}
	t.Time, err = ParseTime(timeFormat, string(data))
	return err
}
1066816
func (id *ID) UnmarshalText(buf []byte) error {
	return id.h.UnmarshalText(buf)
}
163076
func (hb *HEXBytes) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}
	*hb = HEXBytes(b)
	return nil
}
809990
func (b *Bytes) UnmarshalText(input []byte) error {
	raw, err := checkText(input, true)
	if err != nil {
		return err
	}
	dec := make([]byte, len(raw)/2)
	if _, err = hex.Decode(dec, raw); err != nil {
		err = mapError(err)
	} else {
		*b = dec
	}
	return err
}
1309852
func (bh *Header) UnmarshalText(text []byte) error {
	if bh.seenRefs == nil {
		bh.seenRefs = set{}
	}
	if bh.seenGroups == nil {
		bh.seenGroups = set{}
	}
	if bh.seenProgs == nil {
		bh.seenProgs = set{}
	}
	var t Tag
	for i, l := range bytes.Split(text, []byte{'\n'}) {
		if len(l) > 0 && l[len(l)-1] == '\r' {
			l = l[:len(l)-1]
		}
		if len(l) == 0 {
			continue
		}
		if l[0] != '@' || len(l) < 3 {
			return errBadHeader
		}
		copy(t[:], l[1:3])
		var err error
		switch t {
		case headerTag:
			err = headerLine(l, bh)
		case refDictTag:
			err = referenceLine(l, bh)
		case readGroupTag:
			err = readGroupLine(l, bh)
		case programTag:
			err = programLine(l, bh)
		case commentTag:
			err = commentLine(l, bh)
		default:
			return errBadHeader
		}
		if err != nil {
			return fmt.Errorf("%v: line %d: %q", err, i+1, l)
		}
	}

	return nil
}
932038
func (prefix *DevAddrPrefix) UnmarshalText(data []byte) error {
	parsed, err := ParseDevAddrPrefix(string(data))
	if err != nil {
		return err
	}
	*prefix = DevAddrPrefix(parsed)
	return nil
}
1142155
func (k *AES128Key) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}
	if len(b) != len(k) {
		return fmt.Errorf("lorawan: exactly %d bytes are expected", len(k))
	}
	copy(k[:], b)
	return nil
}
1164171
func (s *DLSettings) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}

	return s.UnmarshalBinary(b)
}
210235
func (o *UUID) UnmarshalText(uuid []byte) error {
	id, err := parse(string(uuid))
	if err == nil {
		o.UnmarshalBinary(id)
	}
	return err
}
1174466
func (pe *PathExp) UnmarshalText(b []byte) error {
	o, err := Parse(string(b))
	if err != nil {
		return err
	}

	pe.Org = o.Org
	pe.Project = o.Project
	pe.Envs = o.Envs
	pe.Services = o.Services
	pe.Instances = o.Instances
	pe.Identities = o.Identities

	return nil
}
713188
func (u *UUID) UnmarshalText(text []byte) error {
	t := uuid.UUID{}
	err := t.UnmarshalText(text)
	for i, b := range t.Bytes() {
		u[i] = b
	}
	return err
}
86057
func (n *NetID) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}
	if len(b) != len(n) {
		return fmt.Errorf("lorawan: exactly %d bytes are expected", len(n))
	}
	copy(n[:], b)
	return nil
}
1323886
func (k *OrderAwareKey) UnmarshalText(text []byte) error {
	i := atomic.AddUint64(&keyOrderCounter, 1)
	k.Order = i
	k.Key = string(text)
	return nil
}
759295
func (id *ULID) UnmarshalText(v []byte) error {
	return parse(v, false, id)
}
429022
func (a *DevAddr) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}

	if len(b) != len(a) {
		return fmt.Errorf("lorawan: exactly %d bytes are expected", len(a))
	}
	copy(a[:], b)
	return nil
}
158165
func (level *Level) UnmarshalText(text []byte) error {
	l, err := ParseLevel(string(text))
	if err != nil {
		return err
	}

	*level = Level(l)

	return nil
}