'use strict';

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

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

exports.default = function (pluginContext) {
  return function (data, formatterContext) {
    var getPart = pluginContext.recordDataHelpers.getPart;


    if (!data) {
      return '';
    }

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

    if (!common) {
      return '';
    }

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

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