'use strict';

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

exports.default = function (pluginContext) {
  return function (data) {
    var getPart = pluginContext.recordDataHelpers.getPart;
    var getDisplayName = pluginContext.refNameHelpers.getDisplayName;
    var formatDate = pluginContext.formatHelpers.formatDate;


    if (!data) {
      return '';
    }

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

    if (!common) {
      return '';
    }

    var currentLocation = getDisplayName(common.get('currentLocation'));
    var locationDate = formatDate(common.get('locationDate'));

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