'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, _orgTermGroup, _orgTermGroupList, _organizationRecordTy2, _groups, _functions, _historyNotes, _contactNames, _ns2Organizations_co;

  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:organizations_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.organization.parent',
              'defaultMessage': 'Broader organization'
            },
            children: {
              'id': 'hierarchyInput.organization.children',
              'defaultMessage': 'Narrower organizations'
            },
            siblings: {
              'id': 'hierarchyInput.organization.siblings',
              'defaultMessage': 'Adjacent organizations'
            }
          })
        }
      }
    })), _relRelationsCommon)), _Object$assign), extensions.core.fields, {
      'ns2:organizations_common': (_ns2Organizations_co = {}, _defineProperty(_ns2Organizations_co, config, {
        service: {
          ns: 'http://collectionspace.org/services/organization'
        }
      }), _defineProperty(_ns2Organizations_co, 'csid', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Organizations_co, 'inAuthority', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Organizations_co, 'refName', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Organizations_co, 'shortIdentifier', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Organizations_co, 'orgTermGroupList', (_orgTermGroupList = {}, _defineProperty(_orgTermGroupList, config, {
        messages: (0, _reactIntl.defineMessages)({
          required: {
            'id': 'field.organizations_common.orgTermGroupList.required',
            'defaultMessage': 'At least one term display name is required. Please enter a value.'
          }
        }),
        required: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_orgTermGroupList, 'orgTermGroup', (_orgTermGroup = {}, _defineProperty(_orgTermGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.orgTermGroup.name',
            'defaultMessage': 'Term'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_orgTermGroup, 'termDisplayName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termDisplayName.name',
            'defaultMessage': 'Display name'
          }
        }),
        required: true,
        view: {
          type: TextInput
        }
      })), _defineProperty(_orgTermGroup, 'termName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termName.name',
            'defaultMessage': 'Name'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_orgTermGroup, 'termType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termType.name',
            'defaultMessage': 'Type'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'orgTermTypes'
          }
        }
      })), _defineProperty(_orgTermGroup, 'termFlag', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termFlag.name',
            'defaultMessage': 'Flag'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'orgtermflag'
          }
        }
      })), _defineProperty(_orgTermGroup, 'termStatus', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termStatus.name',
            'defaultMessage': 'Status'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'orgTermStatuses'
          }
        }
      })), _defineProperty(_orgTermGroup, 'termQualifier', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termQualifier.name',
            'defaultMessage': 'Qualifier'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_orgTermGroup, 'termLanguage', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termLanguage.name',
            'defaultMessage': 'Language'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'languages'
          }
        }
      })), _defineProperty(_orgTermGroup, 'termPrefForLang', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termPrefForLang.name',
            'defaultMessage': 'Preferred for lang'
          }
        }),
        view: {
          type: CheckboxInput
        }
      })), _defineProperty(_orgTermGroup, 'termSource', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termSource.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.organizations_common.termSource.fullName',
            'defaultMessage': 'Source name'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'citation/local,citation/worldcat'
          }
        }
      })), _defineProperty(_orgTermGroup, 'termSourceDetail', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termSourceDetail.name',
            'defaultMessage': 'Detail'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_orgTermGroup, 'termSourceID', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termSourceID.name',
            'defaultMessage': 'ID'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_orgTermGroup, 'termSourceNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.termSourceNote.name',
            'defaultMessage': 'Note'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_orgTermGroup, 'mainBodyName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.mainBodyName.name',
            'defaultMessage': 'Main body name'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_orgTermGroup, 'additionsToName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.additionsToName.name',
            'defaultMessage': 'Addition'
          }
        }),
        view: {
          type: TextInput
        }
      })), _orgTermGroup)), _orgTermGroupList)), _defineProperty(_ns2Organizations_co, 'organizationRecordTypes', (_organizationRecordTy2 = {}, _defineProperty(_organizationRecordTy2, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_organizationRecordTy2, 'organizationRecordType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.organizationRecordType.name',
            'defaultMessage': 'Organization type'
          }
        }),
        repeating: true,
        view: {
          type: TermPickerInput,
          props: {
            source: 'organizationtype'
          }
        }
      })), _organizationRecordTy2)), _defineProperty(_ns2Organizations_co, 'foundingDateGroup', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.foundingDateGroup.name',
            'defaultMessage': 'Foundation date'
          }
        }),
        view: {
          type: StructuredDateInput
        }
      })), _defineProperty(_ns2Organizations_co, 'dissolutionDateGroup', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.dissolutionDateGroup.name',
            'defaultMessage': 'Dissolution date'
          }
        }),
        view: {
          type: StructuredDateInput
        }
      })), _defineProperty(_ns2Organizations_co, 'foundingPlace', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.foundingPlace.name',
            'defaultMessage': 'Foundation place'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Organizations_co, 'groups', (_groups = {}, _defineProperty(_groups, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_groups, 'group', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.group.name',
            'defaultMessage': 'Group'
          }
        }),
        repeating: true,
        view: {
          type: TextInput
        }
      })), _groups)), _defineProperty(_ns2Organizations_co, 'functions', (_functions = {}, _defineProperty(_functions, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_functions, 'function', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.function.name',
            'defaultMessage': 'Function'
          }
        }),
        repeating: true,
        view: {
          type: TextInput
        }
      })), _functions)), _defineProperty(_ns2Organizations_co, 'historyNotes', (_historyNotes = {}, _defineProperty(_historyNotes, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_historyNotes, 'historyNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.historyNote.name',
            'defaultMessage': 'History'
          }
        }),
        repeating: true,
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _historyNotes)), _defineProperty(_ns2Organizations_co, 'contactNames', (_contactNames = {}, _defineProperty(_contactNames, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_contactNames, 'contactName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.organizations_common.contactName.name',
            'defaultMessage': 'Contact name'
          }
        }),
        repeating: true,
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local'
          }
        }
      })), _contactNames)), _ns2Organizations_co)
    })
  };
};