'use strict';

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

exports.default = configContext => data => {
  var _configContext$record = configContext.recordDataHelpers;
  const getPart = _configContext$record.getPart,
        deepGet = _configContext$record.deepGet;
  const getDisplayName = configContext.refNameHelpers.getDisplayName;


  if (!data) {
    return '';
  }

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

  if (!common) {
    return '';
  }

  const loanInNumber = common.get('loanInNumber');
  const borrower = getDisplayName(deepGet(common, ['lenderGroupList', 'lenderGroup', 0, 'lender']));

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