import { always, cond, defaultTo, is, isNil, map, pipe, propEq } from 'ramda';
import { formatDataTypeValue, getDateRangeByValue, isEmptyValue } from '@reltio/mdm-sdk';
var formatValue = function (value, dataTypeDefinition, dateTimeMask) {
    return isNil(value) ? "".concat(dateTimeMask) : "".concat(formatDataTypeValue({ dataTypeDefinition: dataTypeDefinition, dateTimeMask: dateTimeMask }, value));
};
export var getEditorLabel = function (placeholder, dataTypeDefinition, value, options) {
    return cond([
        [isEmptyValue, always('')],
        [
            is(Array),
            function (value) { return value.map(function (value) { return formatValue(value, dataTypeDefinition, placeholder); }).join(' \u2014 '); }
        ],
        [is(String), function (value) { var _a; return (_a = options.find(propEq('value', value))) === null || _a === void 0 ? void 0 : _a.label; }]
    ])(value);
};
export var convertValuesToDate = pipe(getDateRangeByValue, defaultTo([]), map(function (value) { return value && new Date(value); }));
