"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _formatHelpers = require("../../../helpers/formatHelpers");

var _default = configContext => (data, formatterContext) => {
  const {
    getPart,
    deepGet
  } = configContext.recordDataHelpers;

  if (!data) {
    return '';
  }

  const common = getPart(data, 'conditionchecks_common');

  if (!common) {
    return '';
  }

  const conditioncheckRefNumber = common.get('conditionCheckRefNumber');
  const condition = deepGet(common, ['conditionCheckGroupList', 'conditionCheckGroup', 0, 'condition']);
  const formattedCondition = (0, _formatHelpers.formatOption)('conditions', condition, formatterContext);
  return [conditioncheckRefNumber, formattedCondition].filter(part => !!part).join(' – ');
};

exports.default = _default;