'use strict';

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

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

exports.default = configContext => {
  var _configContext$inputC = configContext.inputComponents;
  const AutocompleteInput = _configContext$inputC.AutocompleteInput,
        CompoundInput = _configContext$inputC.CompoundInput,
        DateInput = _configContext$inputC.DateInput,
        OptionPickerInput = _configContext$inputC.OptionPickerInput,
        TextInput = _configContext$inputC.TextInput;
  const config = configContext.configHelpers.configKey;
  const extensions = configContext.config.extensions;


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