"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get getEnumPrefix () {
        return getEnumPrefix;
    },
    get isRegisteredEnum () {
        return isRegisteredEnum;
    },
    get throwIfNotRegisteredEnum () {
        return throwIfNotRegisteredEnum;
    },
    get toCamelCase () {
        return toCamelCase;
    }
});
const _constants = require("@tamanu/constants");
const toCamelCase = (value)=>{
    return value.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (_, char)=>char.toUpperCase());
};
const isRegisteredEnum = (enumValues)=>_constants.enumRegistry.has(enumValues);
const getEnumPrefix = (enumValues)=>_constants.prefixMap.get(enumValues);
const throwIfNotRegisteredEnum = (enumValues, fieldName)=>{
    if (!isRegisteredEnum(enumValues)) {
        throw new Error(`enumValues for ${fieldName ? `for field ${fieldName} ` : ''}are not registered in enumRegistry: ${JSON.stringify(enumValues)} `);
    }
    if (!getEnumPrefix(enumValues)) {
        throw new Error(`enumValues for ${fieldName ? `for field ${fieldName} ` : ''}has no associated prefix: ${JSON.stringify(enumValues)}`);
    }
};

//# sourceMappingURL=enumRegistry.js.map