'use strict';

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

var _reactIntl = require('react-intl');

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

exports.default = function (pluginContext) {
  var _ns2RelationsCommon, _personTermGroup, _personTermGroupList, _ns2Persons_common, _document;

  var _pluginContext$inputC = pluginContext.inputComponents,
      AutocompleteInput = _pluginContext$inputC.AutocompleteInput,
      CompoundInput = _pluginContext$inputC.CompoundInput,
      HierarchyInput = _pluginContext$inputC.HierarchyInput,
      TextInput = _pluginContext$inputC.TextInput;
  var config = pluginContext.configHelpers.configKey;


  return {
    document: (_document = {}, _defineProperty(_document, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:persons_common'
        }
      }
    }), _defineProperty(_document, 'ns2:relations-common-list', (_ns2RelationsCommon = {}, _defineProperty(_ns2RelationsCommon, config, {
      service: {
        ns: 'http://collectionspace.org/services/relation'
      }
    }), _defineProperty(_ns2RelationsCommon, 'relation-list-item', _defineProperty({}, config, {
      view: {
        type: HierarchyInput,
        props: {
          messages: (0, _reactIntl.defineMessages)({
            parent: {
              'id': 'hierarchyInput.person.parent',
              'defaultMessage': 'Broader person'
            },
            children: {
              'id': 'hierarchyInput.person.children',
              'defaultMessage': 'Narrower persons'
            },
            siblings: {
              'id': 'hierarchyInput.person.siblings',
              'defaultMessage': 'Adjacent persons'
            }
          })
        }
      }
    })), _ns2RelationsCommon)), _defineProperty(_document, 'ns2:persons_common', (_ns2Persons_common = {}, _defineProperty(_ns2Persons_common, config, {
      service: {
        ns: 'http://collectionspace.org/services/person'
      }
    }), _defineProperty(_ns2Persons_common, 'personTermGroupList', (_personTermGroupList = {}, _defineProperty(_personTermGroupList, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.persons_common.personTermGroupList.name',
          'defaultMessage': 'Terms'
        }
      }),
      view: {
        type: CompoundInput
      }
    }), _defineProperty(_personTermGroupList, 'personTermGroup', (_personTermGroup = {}, _defineProperty(_personTermGroup, config, {
      repeating: true,
      view: {
        type: CompoundInput
      }
    }), _defineProperty(_personTermGroup, 'termDisplayName', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.persons_common.termDisplayName.name',
          'defaultMessage': 'Display name'
        }
      }),
      required: true,
      view: {
        type: TextInput
      }
    })), _defineProperty(_personTermGroup, 'termSource', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.persons_common.termSource.name',
          'defaultMessage': 'Source'
        }
      }),
      view: {
        type: AutocompleteInput,
        props: {
          source: 'citation/local,citation/shared,citation/worldcat'
        }
      }
    })), _personTermGroup)), _personTermGroupList)), _ns2Persons_common)), _document)
  };
};