'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, _taxonTermGroup, _taxonTermGroupList, _taxonAuthorGroup, _taxonAuthorGroupList, _taxonCitationList, _commonNameGroup, _commonNameGroupList, _ns2Taxon_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;
  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:taxon_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.taxon.parent',
              'defaultMessage': 'Broader taxon name'
            },
            children: {
              'id': 'hierarchyInput.taxon.children',
              'defaultMessage': 'Narrower taxon names'
            },
            siblings: {
              'id': 'hierarchyInput.taxon.siblings',
              'defaultMessage': 'Adjacent taxon names'
            }
          })
        }
      }
    })), _relRelationsCommon)), _Object$assign), extensions.core.fields, {
      'ns2:taxon_common': (_ns2Taxon_common = {}, _defineProperty(_ns2Taxon_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/taxonomy'
        }
      }), _defineProperty(_ns2Taxon_common, 'csid', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Taxon_common, 'inAuthority', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Taxon_common, 'refName', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Taxon_common, 'shortIdentifier', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Taxon_common, 'taxonTermGroupList', (_taxonTermGroupList = {}, _defineProperty(_taxonTermGroupList, config, {
        messages: (0, _reactIntl.defineMessages)({
          required: {
            'id': 'field.taxon_common.taxonTermGroupList.required',
            'defaultMessage': 'At least one term display name is required. Please enter a value.'
          }
        }),
        required: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_taxonTermGroupList, 'taxonTermGroup', (_taxonTermGroup = {}, _defineProperty(_taxonTermGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonTermGroup.name',
            'defaultMessage': 'Term'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_taxonTermGroup, 'termDisplayName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termDisplayName.name',
            'defaultMessage': 'Display name'
          }
        }),
        required: true,
        view: {
          type: TextInput
        }
      })), _defineProperty(_taxonTermGroup, 'termName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termName.name',
            'defaultMessage': 'Formatted Display Name'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_taxonTermGroup, 'termType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termType.name',
            'defaultMessage': 'Type'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'taxonTermTypes'
          }
        }
      })), _defineProperty(_taxonTermGroup, 'termFlag', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termFlag.name',
            'defaultMessage': 'Flag'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'taxontermflag'
          }
        }
      })), _defineProperty(_taxonTermGroup, 'termStatus', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termStatus.name',
            'defaultMessage': 'Status'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'taxonTermStatuses'
          }
        }
      })), _defineProperty(_taxonTermGroup, 'termQualifier', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termQualifier.name',
            'defaultMessage': 'Qualifier'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_taxonTermGroup, 'termLanguage', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termLanguage.name',
            'defaultMessage': 'Language'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'languages'
          }
        }
      })), _defineProperty(_taxonTermGroup, 'termPrefForLang', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termPrefForLang.name',
            'defaultMessage': 'Preferred for lang'
          }
        }),
        view: {
          type: CheckboxInput
        }
      })), _defineProperty(_taxonTermGroup, 'termSource', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termSource.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.taxon_common.termSource.fullName',
            'defaultMessage': 'Source name'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'citation/local,citation/shared,citation/worldcat'
          }
        }
      })), _defineProperty(_taxonTermGroup, 'termSourceDetail', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termSourceDetail.name',
            'defaultMessage': 'Detail'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_taxonTermGroup, 'termSourceID', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termSourceID.name',
            'defaultMessage': 'ID'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_taxonTermGroup, 'termSourceNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termSourceNote.name',
            'defaultMessage': 'Note'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_taxonTermGroup, 'termFormattedDisplayName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.termFormattedDisplayName.name',
            'defaultMessage': 'Formatted display name'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_taxonTermGroup, 'taxonomicStatus', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonomicStatus.name',
            'defaultMessage': 'Taxonomic status'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'taxonomicStatuses'
          }
        }
      })), _taxonTermGroup)), _taxonTermGroupList)), _defineProperty(_ns2Taxon_common, 'taxonRank', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonRank.name',
            'defaultMessage': 'Rank'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'taxonRanks'
          }
        }
      })), _defineProperty(_ns2Taxon_common, 'taxonCurrency', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonCurrency.name',
            'defaultMessage': 'Currency'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'taxonCurrencies'
          }
        }
      })), _defineProperty(_ns2Taxon_common, 'taxonAuthorGroupList', (_taxonAuthorGroupList = {}, _defineProperty(_taxonAuthorGroupList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_taxonAuthorGroupList, 'taxonAuthorGroup', (_taxonAuthorGroup = {}, _defineProperty(_taxonAuthorGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonAuthorGroup.name',
            'defaultMessage': 'Author'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput,
          props: {
            tabular: true
          }
        }
      }), _defineProperty(_taxonAuthorGroup, 'taxonAuthor', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonAuthor.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.taxon_common.taxonAuthor.fullName',
            'defaultMessage': 'Author name'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_taxonAuthorGroup, 'taxonAuthorType', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonAuthorType.name',
            'defaultMessage': 'Type'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'taxonAuthorTypes'
          }
        }
      })), _taxonAuthorGroup)), _taxonAuthorGroupList)), _defineProperty(_ns2Taxon_common, 'taxonYear', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonYear.name',
            'defaultMessage': 'Year'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Taxon_common, 'taxonCitationList', (_taxonCitationList = {}, _defineProperty(_taxonCitationList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_taxonCitationList, 'taxonCitation', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonCitation.name',
            'defaultMessage': 'Citation'
          }
        }),
        repeating: true,
        view: {
          type: AutocompleteInput,
          props: {
            source: 'citation/local,citation/shared,citation/worldcat'
          }
        }
      })), _taxonCitationList)), _defineProperty(_ns2Taxon_common, 'taxonIsNamedHybrid', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonIsNamedHybrid.name',
            'defaultMessage': 'Is named hybrid'
          }
        }),
        view: {
          type: CheckboxInput
        }
      })), _defineProperty(_ns2Taxon_common, 'taxonNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.taxonNote.name',
            'defaultMessage': 'Note'
          }
        }),
        searchView: {
          type: TextInput
        },
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _defineProperty(_ns2Taxon_common, 'commonNameGroupList', (_commonNameGroupList = {}, _defineProperty(_commonNameGroupList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_commonNameGroupList, 'commonNameGroup', (_commonNameGroup = {}, _defineProperty(_commonNameGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.commonNameGroup.name',
            'defaultMessage': 'Common name'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput,
          props: {
            tabular: true
          }
        }
      }), _defineProperty(_commonNameGroup, 'commonName', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.commonName.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.taxon_common.commonName.fullName',
            'defaultMessage': 'Common name'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_commonNameGroup, 'commonNameLanguage', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.commonNameLanguage.name',
            'defaultMessage': 'Language'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'languages'
          }
        }
      })), _defineProperty(_commonNameGroup, 'commonNameSource', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.commonNameSource.name',
            'defaultMessage': 'Source'
          },
          fullName: {
            'id': 'field.taxon_common.commonNameSource.fullName',
            'defaultMessage': 'Common name source'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'citation/local,citation/shared'
          }
        }
      })), _defineProperty(_commonNameGroup, 'commonNameSourceDetail', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.taxon_common.commonNameSourceDetail.name',
            'defaultMessage': 'Source detail'
          }
        }),
        view: {
          type: TextInput
        }
      })), _commonNameGroup)), _commonNameGroupList)), _ns2Taxon_common)
    })
  };
};