'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, _locTermGroup, _locTermGroupList, _conditionGroup, _conditionGroupList, _ns2Locations_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,
      DateInput = _pluginContext$inputC.DateInput;
  var config = pluginContext.configHelpers.configKey;
  var DATA_TYPE_DATE = pluginContext.dataTypes.DATA_TYPE_DATE;
  var extensions = pluginContext.config.extensions;


  return {
    document: Object.assign((_Object$assign = {}, _defineProperty(_Object$assign, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:locations_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.location.parent',
              'defaultMessage': 'Broader location'
            },
            children: {
              'id': 'hierarchyInput.location.children',
              'defaultMessage': 'Narrower locations'
            },
            siblings: {
              'id': 'hierarchyInput.location.siblings',
              'defaultMessage': 'Adjacent locations'
            }
          })
        }
      }
    })), _relRelationsCommon)), _Object$assign), extensions.core.fields, {
      'ns2:locations_common': (_ns2Locations_common = {}, _defineProperty(_ns2Locations_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/location'
        }
      }), _defineProperty(_ns2Locations_common, 'csid', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Locations_common, 'inAuthority', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Locations_common, 'refName', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Locations_common, 'shortIdentifier', _defineProperty({}, config, {
        cloneable: false
      })), _defineProperty(_ns2Locations_common, 'locTermGroupList', (_locTermGroupList = {}, _defineProperty(_locTermGroupList, config, {
        messages: (0, _reactIntl.defineMessages)({
          required: {
            'id': 'field.locations_common.locTermGroupList.required',
            'defaultMessage': 'At least one term display name is required. Please enter a value.'
          }
        }),
        required: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_locTermGroupList, 'locTermGroup', (_locTermGroup = {}, _defineProperty(_locTermGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.locations_common.locTermGroup.name',
            'defaultMessage': 'Term'
          }
        }),
        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': 'Type'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'locationTermTypes'
          }
        }
      })), _defineProperty(_locTermGroup, 'termFlag', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.locations_common.termFlag.name',
            'defaultMessage': 'Flag'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'locationtermflag'
          }
        }
      })), _defineProperty(_locTermGroup, 'termStatus', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.locations_common.termStatus.name',
            'defaultMessage': 'Status'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'locationTermStatuses'
          }
        }
      })), _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': 'Preferred for lang'
          }
        }),
        view: {
          type: CheckboxInput
        }
      })), _defineProperty(_locTermGroup, 'termSource', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.locations_common.termSource.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.locations_common.termSource.fullName',
            'defaultMessage': 'Source name'
          }
        }),
        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': 'Detail'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_locTermGroup, 'termSourceID', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.locations_common.termSourceID.name',
            'defaultMessage': 'ID'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_locTermGroup, 'termSourceNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.locations_common.termSourceNote.name',
            'defaultMessage': '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'
          }
        }),
        searchView: {
          type: TextInput
        },
        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, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_conditionGroupList, 'conditionGroup', (_conditionGroup = {}, _defineProperty(_conditionGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.persons_common.conditionGroup.name',
            'defaultMessage': 'Condition note'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput,
          props: {
            tabular: true
          }
        }
      }), _defineProperty(_conditionGroup, 'conditionNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.locations_common.conditionNote.name',
            'defaultMessage': 'Note'
          },
          fullName: {
            'id': 'field.locations_common.conditionNote.fullName',
            'defaultMessage': 'Condition note'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_conditionGroup, 'conditionNoteDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.locations_common.conditionNoteDate.name',
            'defaultMessage': 'Date'
          },
          fullName: {
            'id': 'field.locations_common.conditionNoteDate.fullName',
            'defaultMessage': 'Condition note 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'
          }
        }),
        searchView: {
          type: TextInput
        },
        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 type'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'locationtype'
          }
        }
      })), _ns2Locations_common)
    })
  };
};