'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 _Object$assign2, _languageList, _relationList, _typeList, _dateGroupList, _subjectList;

  var _pluginContext$inputC = pluginContext.inputComponents,
      AutocompleteInput = _pluginContext$inputC.AutocompleteInput,
      CompoundInput = _pluginContext$inputC.CompoundInput,
      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 extensions = pluginContext.config.extensions;


  return {
    document: Object.assign(_defineProperty({}, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:media_common'
        }
      }
    }), extensions.core.fields, {
      'ns2:media_common': Object.assign((_Object$assign2 = {}, _defineProperty(_Object$assign2, config, {
        service: {
          ns: 'http://collectionspace.org/services/media'
        }
      }), _defineProperty(_Object$assign2, '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(_Object$assign2, 'title', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.title.name',
            'defaultMessage': 'Title'
          }
        }),
        view: {
          type: TextInput
        }
      })), _defineProperty(_Object$assign2, 'externalUrl', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.media_common.externalUrl.name',
            'defaultMessage': 'External URL'
          }
        }),
        view: {
          type: TextInput
        }
      })), _Object$assign2), extensions.dimension.fields, {
        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'
            }
          }
        }),
        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'
            }
          }
        }),
        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),
        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'
            }
          }
        }),
        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),
        copyrightStatement: _defineProperty({}, config, {
          messages: (0, _reactIntl.defineMessages)({
            name: {
              'id': 'field.media_common.copyrightStatement.name',
              'defaultMessage': 'Copyright statement'
            }
          }),
          view: {
            type: TextInput
          }
        }),
        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),
        coverage: _defineProperty({}, config, {
          messages: (0, _reactIntl.defineMessages)({
            name: {
              'id': 'field.media_common.coverage.name',
              'defaultMessage': 'Coverage'
            }
          }),
          view: {
            type: TextInput
          }
        }),
        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),
        source: _defineProperty({}, config, {
          messages: (0, _reactIntl.defineMessages)({
            name: {
              'id': 'field.media_common.source.name',
              'defaultMessage': 'Source'
            }
          }),
          view: {
            type: TextInput
          }
        }),
        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),
        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'
            }
          }
        }),
        description: _defineProperty({}, config, {
          messages: (0, _reactIntl.defineMessages)({
            name: {
              'id': 'field.media_common.description.name',
              'defaultMessage': 'Description'
            }
          }),
          view: {
            type: TextInput,
            props: {
              multiline: true
            }
          }
        })
      })
    })
  };
};