'use strict';

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

exports.default = pluginContext => data => {
  var _pluginContext$record = pluginContext.recordDataHelpers;
  const deepGet = _pluginContext$record.deepGet,
        getPart = _pluginContext$record.getPart;


  if (!data) {
    return '';
  }

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

  if (!common) {
    return '';
  }

  const displayName = deepGet(common, ['taxonTermGroupList', 'taxonTermGroup', 0, 'termDisplayName']);
  const termStatus = deepGet(common, ['taxonTermGroupList', 'taxonTermGroup', 0, 'termStatus']);

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