func (n *ACIdentifier) UnmarshalJSON(data []byte) error {
	var s string
	if err := json.Unmarshal(data, &s); err != nil {
		return err
	}
	nn, err := NewACIdentifier(s)
	if err != nil {
		return err
	}
	*n = *nn
	return nil
}
UnmarshalJSON implements the json.Unmarshaler interface
package types
import (
	"encoding/json"
	"errors"
	"regexp"
	"strings"
)
var (
	ValidACIdentifier = regexp.MustCompile("^[a-z0-9]+([-._~/][a-z0-9]+)*$")
	invalidACIdentifierChars = regexp.MustCompile("[^a-z0-9-._~/]")
	invalidACIdentifierEdges = regexp.MustCompile("(^[-._~/]+)|([-._~/]+$)")
	ErrEmptyACIdentifier         = ACIdentifierError("ACIdentifier cannot be empty")
	ErrInvalidEdgeInACIdentifier = ACIdentifierError("ACIdentifier must start and end with only lower case " +
		"alphanumeric characters")
	ErrInvalidCharInACIdentifier = ACIdentifierError("ACIdentifier must contain only lower case " +
		`alphanumeric characters plus "-._~/"`)
)
type ACIdentifier string
func (n ACIdentifier) String() string {
	return string(n)
}
func (n *ACIdentifier) Set(s string) error {
	nn, err := NewACIdentifier(s)
	if err == nil {
		*n = *nn
	}
	return err
}
func (n ACIdentifier) Equals(o ACIdentifier) bool {
	return strings.ToLower(string(n)) == strings.ToLower(string(o))
}
func (n ACIdentifier) Empty() bool {
	return n.String() == ""
}
func NewACIdentifier(s string) (*ACIdentifier, error) {
	n := ACIdentifier(s)
	if err := n.assertValid(); err != nil {
		return nil, err
	}
	return &n, nil
}
func MustACIdentifier(s string) *ACIdentifier {
	n, err := NewACIdentifier(s)
	if err != nil {
		panic(err)
	}
	return n
}
func (n ACIdentifier) assertValid() error {
	s := string(n)
	if len(s) == 0 {
		return ErrEmptyACIdentifier
	}
	if invalidACIdentifierChars.MatchString(s) {
		return ErrInvalidCharInACIdentifier
	}
	if invalidACIdentifierEdges.MatchString(s) {
		return ErrInvalidEdgeInACIdentifier
	}
	return nil
}