'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 _ns2RelationsCommon, _locTermGroup, _locTermGroupList, _conditionGroup, _conditionGroupList, _ns2Locations_common, _document;

  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,
      DateInput = _pluginContext$inputC.DateInput;
  var config = pluginContext.configHelpers.configKey;
  var DATA_TYPE_DATETIME = pluginContext.dataTypes.DATA_TYPE_DATETIME;


  return {
    document: (_document = {}, _defineProperty(_document, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:locations_common'
        }
      }
    }), _defineProperty(_document, 'ns2:relations-common-list', (_ns2RelationsCommon = {}, _defineProperty(_ns2RelationsCommon, config, {
      service: {
        ns: 'http://collectionspace.org/services/relation'
      }
    }), _defineProperty(_ns2RelationsCommon, 'relation-list-item', _defineProperty({}, config, {
      view: {
        type: HierarchyInput,
        props: {
          messages: (0, _reactIntl.defineMessages)({
            parent: {
              'id': 'hierarchyInput.location.parent',
              'defaultMessage': 'Broader context'
            },
            children: {
              'id': 'hierarchyInput.location.children',
              'defaultMessage': 'Narrower context'
            },
            siblings: {
              'id': 'hierarchyInput.location.siblings',
              'defaultMessage': 'Equivalent context'
            }
          })
        }
      }
    })), _ns2RelationsCommon)), _defineProperty(_document, 'ns2:collectionspace_core', {
      createdAt: _defineProperty({}, config, {
        dataType: DATA_TYPE_DATETIME,
        view: {
          type: DateInput
        }
      }),
      createdBy: _defineProperty({}, config, {
        view: {
          type: TextInput
        }
      }),
      updatedAt: _defineProperty({}, config, {
        dataType: DATA_TYPE_DATETIME,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.collectionspace_core.updatedAt.name',
            'defaultMessage': 'Last updated time'
          }
        }),
        view: {
          type: DateInput
        }
      }),
      updatedBy: _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.collectionspace_core.updatedBy.name',
            'defaultMessage': 'Last updated by'
          }
        }),
        view: {
          type: TextInput
        }
      })
    }), _defineProperty(_document, 'ns2:locations_common', (_ns2Locations_common = {}, _defineProperty(_ns2Locations_common, config, {
      service: {
        ns: 'http://collectionspace.org/services/location'
      }
    }), _defineProperty(_ns2Locations_common, 'locTermGroupList', (_locTermGroupList = {}, _defineProperty(_locTermGroupList, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.locTermGroupList.name',
          'defaultMessage': 'Location term group(s)'
        }
      }),
      view: {
        type: CompoundInput
      }
    }), _defineProperty(_locTermGroupList, 'locTermGroup', (_locTermGroup = {}, _defineProperty(_locTermGroup, config, {
      repeating: true,
      view: {
        type: CompoundInput
      }
    }), _defineProperty(_locTermGroup, 'termDisplayName', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termDisplayName.name',
          'defaultMessage': 'Display name'
        }
      }),
      required: true,
      view: {
        type: TextInput
      }
    })), _defineProperty(_locTermGroup, 'termName', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termName.name',
          'defaultMessage': 'Name'
        }
      }),
      view: {
        type: TextInput
      }
    })), _defineProperty(_locTermGroup, 'termType', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termType.name',
          'defaultMessage': 'Term type'
        }
      }),
      view: {
        type: OptionPickerInput,
        props: {
          source: 'termType'
        }
      }
    })), _defineProperty(_locTermGroup, 'termFlag', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termFlag.name',
          'defaultMessage': 'Term flag'
        }
      }),
      view: {
        type: TermPickerInput,
        props: {
          source: 'locationtermflag'
        }
      }
    })), _defineProperty(_locTermGroup, 'termStatus', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termStatus.name',
          'defaultMessage': 'Term status'
        }
      }),
      view: {
        type: OptionPickerInput,
        props: {
          source: 'termStatus'
        }
      }
    })), _defineProperty(_locTermGroup, 'termQualifier', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termQualifier.name',
          'defaultMessage': 'Qualifier'
        }
      }),
      view: {
        type: TextInput
      }
    })), _defineProperty(_locTermGroup, 'termLanguage', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termLanguage.name',
          'defaultMessage': 'Language'
        }
      }),
      view: {
        type: TermPickerInput,
        props: {
          source: 'languages'
        }
      }
    })), _defineProperty(_locTermGroup, 'termPrefForLang', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termPrefForLang.name',
          'defaultMessage': 'Pref for lang'
        }
      }),
      view: {
        type: CheckboxInput
      }
    })), _defineProperty(_locTermGroup, 'termSource', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termSource.name',
          'defaultMessage': 'Source'
        }
      }),
      view: {
        type: AutocompleteInput,
        props: {
          source: 'citation/local,citation/shared,citation/worldcat'
        }
      }
    })), _defineProperty(_locTermGroup, 'termSourceDetail', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termSourceDetail.name',
          'defaultMessage': 'Source detail'
        }
      }),
      view: {
        type: TextInput
      }
    })), _defineProperty(_locTermGroup, 'termSourceID', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termSourceID.name',
          'defaultMessage': 'Source ID'
        }
      }),
      view: {
        type: TextInput
      }
    })), _defineProperty(_locTermGroup, 'termSourceNote', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.termSourceNote.name',
          'defaultMessage': 'Source note'
        }
      }),
      view: {
        type: TextInput
      }
    })), _locTermGroup)), _locTermGroupList)), _defineProperty(_ns2Locations_common, 'accessNote', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.accessNote.name',
          'defaultMessage': 'Access note'
        }
      }),
      view: {
        type: TextInput,
        props: {
          multiline: true
        }
      }
    })), _defineProperty(_ns2Locations_common, 'address', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.address.name',
          'defaultMessage': 'Address'
        }
      }),
      view: {
        type: TextInput
      }
    })), _defineProperty(_ns2Locations_common, 'conditionGroupList', (_conditionGroupList = {}, _defineProperty(_conditionGroupList, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.persons_common.conditionGroupList.name',
          'defaultMessage': 'Condition note'
        }
      }),
      view: {
        type: CompoundInput
      }
    }), _defineProperty(_conditionGroupList, 'conditionGroup', (_conditionGroup = {}, _defineProperty(_conditionGroup, config, {
      repeating: true,
      view: {
        type: CompoundInput,
        props: {
          tabular: true
        }
      }
    }), _defineProperty(_conditionGroup, 'conditionNote', _defineProperty({}, config, {
      message: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.conditionNote.name',
          'defaultMessage': 'Condition note'
        }
      }),
      view: {
        type: TextInput
      }
    })), _defineProperty(_conditionGroup, 'conditionNoteDate', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.conditionNoteDate.name',
          'defaultMessage': 'Date'
        }
      }),
      view: {
        type: DateInput
      }
    })), _conditionGroup)), _conditionGroupList)), _defineProperty(_ns2Locations_common, 'securityNote', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.securityNote.name',
          'defaultMessage': 'Security note'
        }
      }),
      view: {
        type: TextInput,
        props: {
          multiline: true
        }
      }
    })), _defineProperty(_ns2Locations_common, 'locationType', _defineProperty({}, config, {
      messages: (0, _reactIntl.defineMessages)({
        name: {
          'id': 'field.locations_common.locationType.name',
          'defaultMessage': 'Storage location record type'
        }
      }),
      view: {
        type: TermPickerInput,
        props: {
          source: 'locationtype'
        }
      }
    })), _ns2Locations_common)), _document)
  };
};