'use strict';

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

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

exports.default = configContext => (data, formatterContext) => {
  const getPart = configContext.recordDataHelpers.getPart;


  if (!data) {
    return '';
  }

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

  if (!common) {
    return '';
  }

  const valuationcontrolReferenceNumber = common.get('valuationcontrolRefNumber');
  const valueType = common.get('valueType');
  const formattedValueType = (0, _formatHelpers.formatOption)('valueTypes', valueType, formatterContext);

  return [valuationcontrolReferenceNumber, formattedValueType].filter(part => !!part).join(' – ');
};