'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, _personTermGroup, _personTermGroupList, _occupations, _schoolsOrStyles, _groups, _nationalities, _ns2Persons_common;

  var _pluginContext$inputC = pluginContext.inputComponents,
      AutocompleteInput = _pluginContext$inputC.AutocompleteInput,
      CheckboxInput = _pluginContext$inputC.CheckboxInput,
      CompoundInput = _pluginContext$inputC.CompoundInput,
      HierarchyInput = _pluginContext$inputC.HierarchyInput,
      OptionPickerInput = _pluginContext$inputC.OptionPickerInput,
      StructuredDateInput = _pluginContext$inputC.StructuredDateInput,
      TextInput = _pluginContext$inputC.TextInput,
      TermPickerInput = _pluginContext$inputC.TermPickerInput;
  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:persons_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.person.parent',
              'defaultMessage': 'Broader person'
            },
            children: {
              'id': 'hierarchyInput.person.children',
              'defaultMessage': 'Narrower persons'
            },
            siblings: {
              'id': 'hierarchyInput.person.siblings',
              'defaultMessage': 'Adjacent persons'
            }
          })
        }
      }
    })), _relRelationsCommon)), _Object$assign), extensions.core.fields, {
      'ns2:persons_common': (_ns2Persons_common = {}, _defineProperty(_ns2Persons_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/person'
        }
      }), _defineProperty(_ns2Persons_common, 'csid', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Persons_common, 'inAuthority', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Persons_common, 'refName', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Persons_common, 'shortIdentifier', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Persons_common, 'personTermGroupList', (_personTermGroupList = {}, _defineProperty(_personTermGroupList, config, {
        messages: (0, _reactIntl.defineMessages)({
          required: {
            'id': 'field.persons_common.personTermGroupList.required',
            'defaultMessage': 'At least one term display name is required. Please enter a value.'
          }
        }),
        required: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_personTermGroupList, 'personTermGroup', (_personTermGroup = {}, _defineProperty(_personTermGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.personTermGroup.name',
            'defaultMessage': 'Term'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_personTermGroup, 'termDisplayName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termDisplayName.name',
            'defaultMessage': 'Display name'
          }
        }),
        required: true,
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'termFormattedDisplayName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termFormattedDisplayName.name',
            'defaultMessage': 'Formatted display name'
          }
        }),
        view: {
          // TODO: Change to RichTextInput when it's implemented
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'termName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termName.name',
            'defaultMessage': 'Name'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'termQualifier', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termQualifier.name',
            'defaultMessage': 'Qualifier'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'termStatus', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termStatus.name',
            'defaultMessage': 'Status'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'personTermStatuses'
          }
        }
      })), _defineProperty(_personTermGroup, 'termType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termType.name',
            'defaultMessage': 'Type'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'persontermtype'
          }
        }
      })), _defineProperty(_personTermGroup, 'termFlag', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termFlag.name',
            'defaultMessage': 'Flag'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'persontermflag'
          }
        }
      })), _defineProperty(_personTermGroup, 'termLanguage', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termLanguage.name',
            'defaultMessage': 'Language'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'languages'
          }
        }
      })), _defineProperty(_personTermGroup, 'termPrefForLang', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termPrefForLang.name',
            'defaultMessage': 'Preferred for lang'
          }
        }),
        view: {
          type: CheckboxInput
        }
      })), _defineProperty(_personTermGroup, 'salutation', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.salutation.name',
            'defaultMessage': 'Salutation'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'salutations'
          }
        }
      })), _defineProperty(_personTermGroup, 'title', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.title.name',
            'defaultMessage': 'Title'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'personTitles'
          }
        }
      })), _defineProperty(_personTermGroup, 'foreName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.forename.name',
            'defaultMessage': 'Forename'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'middleName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.middleName.name',
            'defaultMessage': 'Middle name'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'surName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.surname.name',
            'defaultMessage': 'Surname'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'nameAdditions', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.nameAdditions.name',
            'defaultMessage': 'Addition'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'initials', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.initials.name',
            'defaultMessage': 'Initials'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'termSource', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termSource.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.persons_common.termSource.fullName',
            'defaultMessage': 'Source name'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'citation/local,citation/shared,citation/worldcat'
          }
        }
      })), _defineProperty(_personTermGroup, 'termSourceDetail', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termSourceDetail.name',
            'defaultMessage': 'Detail'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'termSourceID', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termSourceID.name',
            'defaultMessage': 'ID'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_personTermGroup, 'termSourceNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.termSourceNote.name',
            'defaultMessage': 'Note'
          }
        }),
        view: {
          type: TextInput
        }
      })), _personTermGroup)), _personTermGroupList)), _defineProperty(_ns2Persons_common, 'gender', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.gender.name',
            'defaultMessage': 'Gender'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'genders'
          }
        }
      })), _defineProperty(_ns2Persons_common, 'occupations', (_occupations = {}, _defineProperty(_occupations, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_occupations, 'occupation', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.occupation.name',
            'defaultMessage': 'Occupation'
          }
        }),
        repeating: true,
        view: {
          type: TextInput
        }
      })), _occupations)), _defineProperty(_ns2Persons_common, 'schoolsOrStyles', (_schoolsOrStyles = {}, _defineProperty(_schoolsOrStyles, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_schoolsOrStyles, 'schoolOrStyle', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.schoolOrStyle.name',
            'defaultMessage': 'School/style'
          }
        }),
        repeating: true,
        view: {
          type: TextInput
        }
      })), _schoolsOrStyles)), _defineProperty(_ns2Persons_common, 'groups', (_groups = {}, _defineProperty(_groups, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_groups, 'group', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.group.name',
            'defaultMessage': 'Group'
          }
        }),
        repeating: true,
        view: {
          type: TextInput
        }
      })), _groups)), _defineProperty(_ns2Persons_common, 'nationalities', (_nationalities = {}, _defineProperty(_nationalities, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_nationalities, 'nationality', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.nationality.name',
            'defaultMessage': 'Nationality'
          }
        }),
        repeating: true,
        view: {
          type: TextInput
        }
      })), _nationalities)), _defineProperty(_ns2Persons_common, 'nameNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.nameNote.name',
            'defaultMessage': 'Name note'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _defineProperty(_ns2Persons_common, 'birthDateGroup', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.birthDateGroup.name',
            'defaultMessage': 'Birth date'
          }
        }),
        view: {
          type: StructuredDateInput
        }
      })), _defineProperty(_ns2Persons_common, 'birthPlace', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.birthPlace.name',
            'defaultMessage': 'Place of birth'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Persons_common, 'deathDateGroup', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.deathDateGroup.name',
            'defaultMessage': 'Death date'
          }
        }),
        view: {
          type: StructuredDateInput
        }
      })), _defineProperty(_ns2Persons_common, 'deathPlace', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.deathPlace.name',
            'defaultMessage': 'Place of death'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Persons_common, 'bioNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.bioNote.name',
            'defaultMessage': 'Biographical note'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _ns2Persons_common)
    })
  };
};