"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAttributeDefaultValues = exports.getUserAttributeValues = void 0;
/**
 * Normalize a value entry that may carry the deprecated single `value` field
 * or the canonical `values` array into a plain `string[]`.
 */
const getUserAttributeValues = (entry) => {
    if (entry.values && entry.values.length > 0) {
        return entry.values;
    }
    if (entry.value !== undefined && entry.value !== '') {
        return [entry.value];
    }
    return [];
};
exports.getUserAttributeValues = getUserAttributeValues;
/**
 * Resolve the canonical `attributeDefaults` array (preferred) or the deprecated
 * `attributeDefault` (array or single string) into `string[] | null`
 * (null = no default).
 */
const getAttributeDefaultValues = (entry) => {
    if (entry.attributeDefaults !== undefined) {
        const defaults = entry.attributeDefaults;
        return defaults && defaults.length > 0 ? defaults : null;
    }
    const legacy = entry.attributeDefault;
    if (legacy == null) {
        return null;
    }
    if (Array.isArray(legacy)) {
        return legacy.length > 0 ? legacy : null;
    }
    return legacy === '' ? null : [legacy];
};
exports.getAttributeDefaultValues = getAttributeDefaultValues;
//# sourceMappingURL=userAttributes.js.map