import { defaultErrorTranslator } from '@jsonforms/core';
/**
 * @privateRemarks
 * This is a map of validation patterns to human readable error messages.
 * The idea is to add common patterns here so all apps get the human readable error messages by default instead of the AJV ones,
 * without having to implement the same custom i18n options in each app.
 */
const MAP = {
    '^[\\+]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$': 'Invalid phone number. Must match +###-###-######',
};
export const genesisErrorTranslator = (error, t, uischema) => {
    var _a;
    if ((error === null || error === void 0 ? void 0 : error.keyword) === 'pattern') {
        return (_a = MAP[error.params.pattern]) !== null && _a !== void 0 ? _a : 'Invalid pattern.';
    }
    return defaultErrorTranslator(error, t, uischema);
};
//# sourceMappingURL=translation.js.map