'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 _movementMethods, _inventoryContactList, _ns2Movements_common;

  var _pluginContext$inputC = pluginContext.inputComponents,
      AutocompleteInput = _pluginContext$inputC.AutocompleteInput,
      CompoundInput = _pluginContext$inputC.CompoundInput,
      DateInput = _pluginContext$inputC.DateInput,
      IDGeneratorInput = _pluginContext$inputC.IDGeneratorInput,
      OptionPickerInput = _pluginContext$inputC.OptionPickerInput,
      TextInput = _pluginContext$inputC.TextInput;
  var config = pluginContext.configHelpers.configKey;
  var DATA_TYPE_DATE = pluginContext.dataTypes.DATA_TYPE_DATE;
  var extensions = pluginContext.config.extensions;


  return {
    document: Object.assign(_defineProperty({}, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:movements_common'
        }
      }
    }), extensions.core.fields, {
      'ns2:movements_common': (_ns2Movements_common = {}, _defineProperty(_ns2Movements_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/movement'
        }
      }), _defineProperty(_ns2Movements_common, 'movementReferenceNumber', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.movementReferenceNumber.name',
            'defaultMessage': 'Reference number'
          }
        }),
        searchView: {
          type: TextInput
        },
        view: {
          type: IDGeneratorInput,
          props: {
            idGeneratorName: 'inventory,location,movement'
          }
        }
      })), _defineProperty(_ns2Movements_common, 'normalLocation', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.normalLocation.name',
            'defaultMessage': 'Normal location'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'location/local'
          }
        }
      })), _defineProperty(_ns2Movements_common, 'currentLocation', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.currentLocation.name',
            'defaultMessage': 'Location'
          },
          fullName: {
            'id': 'field.movements_common.currentLocation.fullName',
            'defaultMessage': 'Current location'
          }
        }),
        required: true,
        view: {
          type: AutocompleteInput,
          props: {
            source: 'location/local,location/offsite,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_ns2Movements_common, 'currentLocationFitness', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.currentLocationFitness.name',
            'defaultMessage': 'Fitness'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'locationFitnesses'
          }
        }
      })), _defineProperty(_ns2Movements_common, 'currentLocationNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.currentLocationNote.name',
            'defaultMessage': 'Note'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Movements_common, 'locationDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.locationDate.name',
            'defaultMessage': 'Location date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Movements_common, 'reasonForMove', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.reasonForMove.name',
            'defaultMessage': 'Reason for move'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'moveReasons'
          }
        }
      })), _defineProperty(_ns2Movements_common, 'movementMethods', (_movementMethods = {}, _defineProperty(_movementMethods, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_movementMethods, 'movementMethod', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.movementMethod.name',
            'defaultMessage': 'Movement method'
          }
        }),
        repeating: true,
        view: {
          type: OptionPickerInput,
          props: {
            source: 'moveMethods'
          }
        }
      })), _movementMethods)), _defineProperty(_ns2Movements_common, 'plannedRemovalDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.plannedRemovalDate.name',
            'defaultMessage': 'Planned removal date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Movements_common, 'removalDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.removalDate.name',
            'defaultMessage': 'Removal date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Movements_common, 'movementContact', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.movementContact.name',
            'defaultMessage': 'Contact'
          },
          fullName: {
            'id': 'field.movements_common.movementContact.fullName',
            'defaultMessage': 'Movement contact'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared'
          }
        }
      })), _defineProperty(_ns2Movements_common, 'movementNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.movementNote.name',
            'defaultMessage': 'Note'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _defineProperty(_ns2Movements_common, 'inventoryActionRequired', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.inventoryActionRequired.name',
            'defaultMessage': 'Inventory action required'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'invActions'
          }
        }
      })), _defineProperty(_ns2Movements_common, 'frequencyForInventory', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.frequencyForInventory.name',
            'defaultMessage': 'Inventory frequency'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'invFreqs'
          }
        }
      })), _defineProperty(_ns2Movements_common, 'inventoryDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.inventoryDate.name',
            'defaultMessage': 'Inventory date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Movements_common, 'nextInventoryDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.nextInventoryDate.name',
            'defaultMessage': 'Next inventory date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Movements_common, 'inventoryContactList', (_inventoryContactList = {}, _defineProperty(_inventoryContactList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_inventoryContactList, 'inventoryContact', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.inventoryContact.name',
            'defaultMessage': 'Contact'
          },
          fullName: {
            'id': 'field.movements_common.inventoryContact.fullName',
            'defaultMessage': 'Inventory contact'
          }
        }),
        repeating: true,
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared'
          }
        }
      })), _inventoryContactList)), _defineProperty(_ns2Movements_common, 'inventoryNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.movements_common.inventoryNote.name',
            'defaultMessage': 'Note'
          },
          fullName: {
            'id': 'field.movements_common.inventoryNote.fullName',
            'defaultMessage': 'Inventory note'
          }
        }),
        searchView: {
          type: TextInput
        },
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _ns2Movements_common)
    })
  };
};