'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _reactIntl = require('react-intl');

var _coreFields = require('../../../helpers/coreFields');

var _coreFields2 = _interopRequireDefault(_coreFields);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 _dimensionSubGroup, _dimensionSubGroupLis, _measuredPartGroup, _measuredPartGroupLis, _languageList, _relationList, _typeList, _dateGroupList, _subjectList, _ns2Media_common;

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


  var coreFields = (0, _coreFields2.default)(pluginContext);

  return {
    document: Object.assign(_defineProperty({}, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:media_common'
        }
      }
    }), coreFields, {
      'ns2:media_common': (_ns2Media_common = {}, _defineProperty(_ns2Media_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/media'
        }
      }), _defineProperty(_ns2Media_common, 'identificationNumber', _defineProperty({}, config, {
        cloneable: false,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.identificationNumber.name',
            'defaultMessage': 'Identification number'
          }
        }),
        required: true,
        searchView: {
          type: TextInput
        },
        view: {
          type: IDGeneratorInput,
          props: {
            idGeneratorName: 'media'
          }
        }
      })), _defineProperty(_ns2Media_common, 'title', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.title.name',
            'defaultMessage': 'Title'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Media_common, 'externalUrl', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.externalUrl.name',
            'defaultMessage': 'External URL'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Media_common, 'measuredPartGroupList', (_measuredPartGroupLis = {}, _defineProperty(_measuredPartGroupLis, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_measuredPartGroupLis, 'measuredPartGroup', (_measuredPartGroup = {}, _defineProperty(_measuredPartGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.measuredPartGroup.name',
            'defaultMessage': 'Dimensions'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_measuredPartGroup, 'measuredPart', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.measuredPart.name',
            'defaultMessage': 'Part'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'measuredParts'
          }
        }
      })), _defineProperty(_measuredPartGroup, 'dimensionSummary', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.dimensionSummary.name',
            'defaultMessage': 'Summary'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_measuredPartGroup, 'dimensionSubGroupList', (_dimensionSubGroupLis = {}, _defineProperty(_dimensionSubGroupLis, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_dimensionSubGroupLis, 'dimensionSubGroup', (_dimensionSubGroup = {}, _defineProperty(_dimensionSubGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.dimensionSubGroup.name',
            'defaultMessage': 'Measurements'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput,
          props: {
            tabular: true
          }
        }
      }), _defineProperty(_dimensionSubGroup, 'dimension', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.dimension.name',
            'defaultMessage': 'Dimension'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'dimensions'
          }
        }
      })), _defineProperty(_dimensionSubGroup, 'measuredBy', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.measuredBy.name',
            'defaultMessage': 'Measured by'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_dimensionSubGroup, 'measurementMethod', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.measurementMethod.name',
            'defaultMessage': 'Method'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'measurementMethods'
          }
        }
      })), _defineProperty(_dimensionSubGroup, 'value', _defineProperty({}, config, {
        dataType: DATA_TYPE_FLOAT,
        messages: (0, _reactIntl.defineMessages)({
          fullName: {
            'id': 'field.media_common.value.fullName',
            'defaultMessage': 'Measurement value'
          },
          name: {
            'id': 'field.media_common.value.name',
            'defaultMessage': 'Value'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_dimensionSubGroup, 'measurementUnit', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.measurementUnit.name',
            'defaultMessage': 'Unit'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'measurementUnits'
          }
        }
      })), _defineProperty(_dimensionSubGroup, 'valueQualifier', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.valueQualifier.name',
            'defaultMessage': 'Qualifier'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_dimensionSubGroup, 'valueDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.valueDate.name',
            'defaultMessage': 'Date'
          },
          fullName: {
            'id': 'field.media_common.valueDate.fullName',
            'defaultMessage': 'Measurement date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _dimensionSubGroup)), _dimensionSubGroupLis)), _measuredPartGroup)), _measuredPartGroupLis)), _defineProperty(_ns2Media_common, 'contributor', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.contributor.name',
            'defaultMessage': 'Contributor'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_ns2Media_common, 'creator', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.creator.name',
            'defaultMessage': 'Creator'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_ns2Media_common, 'languageList', (_languageList = {}, _defineProperty(_languageList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_languageList, 'language', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.language.name',
            'defaultMessage': 'Language'
          }
        }),
        repeating: true,
        view: {
          type: TermPickerInput,
          props: {
            source: 'languages'
          }
        }
      })), _languageList)), _defineProperty(_ns2Media_common, 'publisher', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.publisher.name',
            'defaultMessage': 'Publisher'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_ns2Media_common, 'relationList', (_relationList = {}, _defineProperty(_relationList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_relationList, 'relation', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.relation.name',
            'defaultMessage': 'Relation'
          }
        }),
        repeating: true,
        view: {
          type: TextInput
        }
      })), _relationList)), _defineProperty(_ns2Media_common, 'copyrightStatement', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.copyrightStatement.name',
            'defaultMessage': 'Copyright statement'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Media_common, 'typeList', (_typeList = {}, _defineProperty(_typeList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_typeList, 'type', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.type.name',
            'defaultMessage': 'Type'
          }
        }),
        repeating: true,
        view: {
          type: OptionPickerInput,
          props: {
            source: 'mediaTypes'
          }
        }
      })), _typeList)), _defineProperty(_ns2Media_common, 'coverage', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.coverage.name',
            'defaultMessage': 'Coverage'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Media_common, 'dateGroupList', (_dateGroupList = {}, _defineProperty(_dateGroupList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_dateGroupList, 'dateGroup', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.dateGroup.name',
            'defaultMessage': 'Date'
          }
        }),
        repeating: true,
        view: {
          type: StructuredDateInput
        }
      })), _dateGroupList)), _defineProperty(_ns2Media_common, 'source', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.source.name',
            'defaultMessage': 'Source'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_ns2Media_common, 'subjectList', (_subjectList = {}, _defineProperty(_subjectList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_subjectList, 'subject', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.subject.name',
            'defaultMessage': 'Subject'
          }
        }),
        repeating: true,
        view: {
          type: TextInput
        }
      })), _subjectList)), _defineProperty(_ns2Media_common, 'rightsHolder', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.rightsHolder.name',
            'defaultMessage': 'Rights holder'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_ns2Media_common, 'description', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.description.name',
            'defaultMessage': 'Description'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _ns2Media_common)
    })
  };
};