'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;
    var getDisplayName = pluginContext.refNameHelpers.getDisplayName;


    if (!cspaceDocument) {
      return '';
    }

    var common = getPart(cspaceDocument, '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(' – ');
  };
};