'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, 'conservation_common');

    if (!common) {
      return '';
    }

    var conservationNumber = common.get('conservationNumber');
    var status = getDisplayName(deepGet(common, ['conservationStatusGroupList', 'conservationStatusGroup', 0, 'status']));

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