'use strict';

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

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


    if (!data) {
      return '';
    }

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

    if (!common) {
      return '';
    }

    var acquisitionReferenceNumber = common.get('acquisitionReferenceNumber');
    var acquisitionSource = getDisplayName(deepGet(common, ['acquisitionSources', 'acquisitionSource', 0]));

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