'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports.default = function (pluginContext) {
  return function (cspaceDocument) {
    var _pluginContext$record = pluginContext.recordDataHelpers,
        getPart = _pluginContext$record.getPart,
        deepGet = _pluginContext$record.deepGet;


    if (!cspaceDocument) {
      return '';
    }

    var common = getPart(cspaceDocument, 'conditionchecks_common');

    if (!common) {
      return '';
    }

    var conditioncheckRefNumber = common.get('conditionCheckRefNumber');
    var condition = deepGet(common, ['conditionCheckGroupList', 'conditionCheckGroup', 0, 'condition']);

    return [conditioncheckRefNumber, condition].filter(function (part) {
      return !!part;
    }).join(' – ');
  };
};