'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 _relRelationsCommon, _Object$assign, _workTermGroup, _workTermGroupList, _workDateGroupList, _creatorGroup, _creatorGroupList, _publisherGroup, _publisherGroupList, _addrGroup, _addrGroupList, _ns2Works_common;

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


  return {
    document: Object.assign((_Object$assign = {}, _defineProperty(_Object$assign, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:works_common'
        }
      }
    }), _defineProperty(_Object$assign, 'rel:relations-common-list', (_relRelationsCommon = {}, _defineProperty(_relRelationsCommon, config, {
      service: {
        ns: 'http://collectionspace.org/services/relation'
      }
    }), _defineProperty(_relRelationsCommon, 'relation-list-item', _defineProperty({}, config, {
      view: {
        type: HierarchyInput,
        props: {
          messages: (0, _reactIntl.defineMessages)({
            parent: {
              'id': 'hierarchyInput.work.parent',
              'defaultMessage': 'Broader work'
            },
            children: {
              'id': 'hierarchyInput.work.children',
              'defaultMessage': 'Narrower works'
            },
            siblings: {
              'id': 'hierarchyInput.work.siblings',
              'defaultMessage': 'Adjacent works'
            }
          })
        }
      }
    })), _relRelationsCommon)), _Object$assign), extensions.core.fields, {
      'ns2:works_common': (_ns2Works_common = {}, _defineProperty(_ns2Works_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/work'
        }
      }), _defineProperty(_ns2Works_common, 'csid', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Works_common, 'inAuthority', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Works_common, 'refName', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Works_common, 'shortIdentifier', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Works_common, 'workTermGroupList', (_workTermGroupList = {}, _defineProperty(_workTermGroupList, config, {
        messages: (0, _reactIntl.defineMessages)({
          required: {
            'id': 'field.works_common.workTermGroupList.required',
            'defaultMessage': 'At least one term display name is required. Please enter a value.'
          }
        }),
        required: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_workTermGroupList, 'workTermGroup', (_workTermGroup = {}, _defineProperty(_workTermGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.workTermGroup.name',
            'defaultMessage': 'Term'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_workTermGroup, 'termDisplayName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termDisplayName.name',
            'defaultMessage': 'Display name'
          }
        }),
        required: true,
        view: {
          type: TextInput
        }
      })), _defineProperty(_workTermGroup, 'termName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termName.name',
            'defaultMessage': 'Name'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_workTermGroup, 'termType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termType.name',
            'defaultMessage': 'Type'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_workTermGroup, 'termFlag', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termFlag.name',
            'defaultMessage': 'Flag'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'worktermflag'
          }
        }
      })), _defineProperty(_workTermGroup, 'termStatus', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termStatus.name',
            'defaultMessage': 'Status'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'workTermStatuses'
          }
        }
      })), _defineProperty(_workTermGroup, 'termQualifier', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termQualifier.name',
            'defaultMessage': 'Qualifier'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_workTermGroup, 'termLanguage', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termLanguage.name',
            'defaultMessage': 'Language'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'languages'
          }
        }
      })), _defineProperty(_workTermGroup, 'termPrefForLang', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termPrefForLang.name',
            'defaultMessage': 'Preferred for lang'
          }
        }),
        view: {
          type: CheckboxInput
        }
      })), _defineProperty(_workTermGroup, 'termSource', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termSource.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.works_common.termSource.fullName',
            'defaultMessage': 'Source name'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'citation/local,citation/shared,citation/worldcat'
          }
        }
      })), _defineProperty(_workTermGroup, 'termSourceDetail', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termSourceDetail.name',
            'defaultMessage': 'Detail'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_workTermGroup, 'termSourceID', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termSourceID.name',
            'defaultMessage': 'ID'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_workTermGroup, 'termSourceNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.termSourceNote.name',
            'defaultMessage': 'Note'
          }
        }),
        view: {
          type: TextInput
        }
      })), _workTermGroup)), _workTermGroupList)), _defineProperty(_ns2Works_common, 'workType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.workType.name',
            'defaultMessage': 'Work type'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'worktype'
          }
        }
      })), _defineProperty(_ns2Works_common, 'workDateGroupList', (_workDateGroupList = {}, _defineProperty(_workDateGroupList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_workDateGroupList, 'workDateGroup', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.workDateGroup.name',
            'defaultMessage': 'Work date'
          }
        }),
        repeating: true,
        view: {
          type: StructuredDateInput
        }
      })), _workDateGroupList)), _defineProperty(_ns2Works_common, 'workHistoryNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.workHistoryNote.name',
            'defaultMessage': 'History note'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _defineProperty(_ns2Works_common, 'creatorGroupList', (_creatorGroupList = {}, _defineProperty(_creatorGroupList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_creatorGroupList, 'creatorGroup', (_creatorGroup = {}, _defineProperty(_creatorGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.creatorGroup.name',
            'defaultMessage': 'Creator'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput,
          props: {
            tabular: true
          }
        }
      }), _defineProperty(_creatorGroup, 'creator', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.creator.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.works_common.creator.fullName',
            'defaultMessage': 'Creator name'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_creatorGroup, 'creatorType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.creatorType.name',
            'defaultMessage': 'Type'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'workcreatortype'
          }
        }
      })), _creatorGroup)), _creatorGroupList)), _defineProperty(_ns2Works_common, 'publisherGroupList', (_publisherGroupList = {}, _defineProperty(_publisherGroupList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_publisherGroupList, 'publisherGroup', (_publisherGroup = {}, _defineProperty(_publisherGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.publisherGroup.name',
            'defaultMessage': 'Publisher'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput,
          props: {
            tabular: true
          }
        }
      }), _defineProperty(_publisherGroup, 'publisher', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.publisher.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.works_common.publisher.fullName',
            'defaultMessage': 'Publisher name'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_publisherGroup, 'publisherType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.publisherType.name',
            'defaultMessage': 'Type'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'workpublishertype'
          }
        }
      })), _publisherGroup)), _publisherGroupList)), _defineProperty(_ns2Works_common, 'addrGroupList', (_addrGroupList = {}, _defineProperty(_addrGroupList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_addrGroupList, 'addrGroup', (_addrGroup = {}, _defineProperty(_addrGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.addrGroup.name',
            'defaultMessage': 'Address'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_addrGroup, 'addressType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.addressType.name',
            'defaultMessage': 'Type'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'addresstype'
          }
        }
      })), _defineProperty(_addrGroup, 'addressPlace1', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.addressPlace1.name',
            'defaultMessage': 'Line 1'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_addrGroup, 'addressPlace2', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.addressPlace2.name',
            'defaultMessage': 'Line 2'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_addrGroup, 'addressMunicipality', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.addressMunicipality.name',
            'defaultMessage': 'Municipality'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'place/local,place/tgn'
          }
        }
      })), _defineProperty(_addrGroup, 'addressStateOrProvince', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.addressStateOrProvince.name',
            'defaultMessage': 'State/Province'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'place/local,place/tgn'
          }
        }
      })), _defineProperty(_addrGroup, 'addressPostCode', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.addressPostCode.name',
            'defaultMessage': 'Postal code'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_addrGroup, 'addressCountry', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.works_common.addressCountry.name',
            'defaultMessage': 'Country'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'place/local,place/tgn'
          }
        }
      })), _addrGroup)), _addrGroupList)), _ns2Works_common)
    })
  };
};