'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 _ns2Vocabularies_com, _listItem, _ns2AbstractCommon;

  var _pluginContext$inputC = pluginContext.inputComponents,
      CompoundInput = _pluginContext$inputC.CompoundInput,
      OptionPickerInput = _pluginContext$inputC.OptionPickerInput,
      TextInput = _pluginContext$inputC.TextInput,
      WorkflowStateInput = _pluginContext$inputC.WorkflowStateInput;
  var config = pluginContext.configHelpers.configKey;
  var extensions = pluginContext.config.extensions;


  return {
    document: Object.assign(_defineProperty({}, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:vocabularies_common'
        }
      }
    }), extensions.core.fields, {
      'ns2:vocabularies_common': (_ns2Vocabularies_com = {}, _defineProperty(_ns2Vocabularies_com, config, {
        service: {
          ns: 'http://collectionspace.org/services/vocabulary'
        },
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_ns2Vocabularies_com, 'displayName', _defineProperty({}, config, {
        cloneable: false,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularies_common.displayName.name',
            'defaultMessage': 'Name'
          }
        }),
        required: true,
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Vocabularies_com, 'source', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularies_common.source.name',
            'defaultMessage': 'Source'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Vocabularies_com, 'description', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularies_common.description.name',
            'defaultMessage': 'Description'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _ns2Vocabularies_com),
      'ns2:abstract-common-list': (_ns2AbstractCommon = {}, _defineProperty(_ns2AbstractCommon, config, {
        service: {
          ns: 'http://collectionspace.org/services/jaxb'
        },
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_ns2AbstractCommon, 'list-item', (_listItem = {}, _defineProperty(_listItem, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularyitems_common.list-item.name',
            'defaultMessage': 'Terms'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput,
          props: {
            tabular: true,
            sortableFields: {
              displayName: true
            }
          }
        }
      }), _defineProperty(_listItem, 'displayName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularyitems_common.displayName.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.vocabularyitems_common.displayName.fullName',
            'defaultMessage': 'Term name'
          }
        }),
        required: true,
        view: {
          type: TextInput
        }
      })), _defineProperty(_listItem, 'description', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularyitems_common.description.name',
            'defaultMessage': 'Description'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_listItem, 'source', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularyitems_common.source.name',
            'defaultMessage': 'Source'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_listItem, 'sourcePage', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularyitems_common.sourcePage.name',
            'defaultMessage': 'Source page'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_listItem, 'termStatus', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.vocabularyitems_common.termStatus.name',
            'defaultMessage': 'Status'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'vocabTermStatuses'
          }
        }
      })), _defineProperty(_listItem, 'workflowState', _defineProperty({}, config, {
        view: {
          type: WorkflowStateInput
        }
      })), _listItem)), _ns2AbstractCommon)
    })
  };
};