func (a CoreAttribute) Name() string {
	return a.name
}
Name returns the case insensitive name of the attribute.
package schema
import (
	"encoding/json"
	"fmt"
	"regexp"
	"strings"
	datetime "github.com/di-wu/xsd-datetime"
	"github.com/elimity-com/scim/errors"
	"github.com/elimity-com/scim/optional"
)
type CoreAttribute struct {
	canonicalValues []string
	caseExact       bool
	description     optional.String
	multiValued     bool
	mutability      attributeMutability
	name            string
	referenceTypes  []AttributeReferenceType
	required        bool
	returned        attributeReturned
	subAttributes   Attributes
	typ             attributeType
	uniqueness      attributeUniqueness
}
func ComplexCoreAttribute(params ComplexParams) CoreAttribute {
	checkAttributeName(params.Name)
	names := map[string]int{}
	var sa []CoreAttribute
	for i, a := range params.SubAttributes {
		name := strings.ToLower(a.name)
		if j, ok := names[name]; ok {
			panic(fmt.Errorf("duplicate name %q for sub-attributes %d and %d", name, i, j))
		}
		names[name] = i
		sa = append(sa, CoreAttribute{
			canonicalValues: a.canonicalValues,
			caseExact:       a.caseExact,
			description:     a.description,
			multiValued:     a.multiValued,
			mutability:      a.mutability,
			name:            a.name,
			referenceTypes:  a.referenceTypes,
			required:        a.required,
			returned:        a.returned,
			typ:             a.typ,
			uniqueness:      a.uniqueness,
		})
	}
	return CoreAttribute{
		description:   params.Description,
		multiValued:   params.MultiValued,
		mutability:    params.Mutability.m,
		name:          params.Name,
		required:      params.Required,
		returned:      params.Returned.r,
		subAttributes: sa,
		typ:           attributeDataTypeComplex,
		uniqueness:    params.Uniqueness.u,
	}
}
func SimpleCoreAttribute(params SimpleParams) CoreAttribute {
	checkAttributeName(params.name)
	return CoreAttribute{
		canonicalValues: params.canonicalValues,
		caseExact:       params.caseExact,
		description:     params.description,
		multiValued:     params.multiValued,
		mutability:      params.mutability,
		name:            params.name,
		referenceTypes:  params.referenceTypes,
		required:        params.required,
		returned:        params.returned,
		typ:             params.typ,
		uniqueness:      params.uniqueness,
	}
}
func (a CoreAttribute) AttributeType() string {
	return a.typ.String()
}
func (a CoreAttribute) CanonicalValues() []string {
	return a.canonicalValues
}
func (a CoreAttribute) CaseExact() bool {
	return a.caseExact
}
func (a CoreAttribute) Description() string {
	return a.description.Value()
}
func (a CoreAttribute) HasSubAttributes() bool {
	return a.typ == attributeDataTypeComplex && len(a.subAttributes) != 0
}
func (a CoreAttribute) MultiValued() bool {
	return a.multiValued
}
func (a CoreAttribute) Mutability() string {
	raw, _ := a.mutability.MarshalJSON()
	return string(raw)
}