'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 _ns2Groups_common;

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


  return {
    document: Object.assign(_defineProperty({}, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:groups_common'
        }
      }
    }), extensions.core.fields, {
      'ns2:groups_common': (_ns2Groups_common = {}, _defineProperty(_ns2Groups_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/group'
        }
      }), _defineProperty(_ns2Groups_common, 'title', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.groups_common.title.name',
            'defaultMessage': 'Title'
          }
        }),
        required: true,
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Groups_common, 'responsibleDepartment', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.groups_common.responsibleDepartment.name',
            'defaultMessage': 'Responsible department'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'departments'
          }
        }
      })), _defineProperty(_ns2Groups_common, 'owner', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.groups_common.owner.name',
            'defaultMessage': 'Group owner'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local'
          }
        }
      })), _defineProperty(_ns2Groups_common, 'scopeNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.groups_common.scopeNote.name',
            'defaultMessage': 'Scope note'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _ns2Groups_common)
    })
  };
};