'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 _ns2Blobs_common;

  var _pluginContext$inputC = pluginContext.inputComponents,
      CompoundInput = _pluginContext$inputC.CompoundInput,
      ReadOnlyInput = _pluginContext$inputC.ReadOnlyInput,
      UploadInput = _pluginContext$inputC.UploadInput;
  var config = pluginContext.configHelpers.configKey;
  var extensions = pluginContext.config.extensions;


  return {
    document: Object.assign(_defineProperty({}, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:blobs_common'
        }
      }
    }), extensions.core.fields, {
      'ns2:blobs_common': (_ns2Blobs_common = {}, _defineProperty(_ns2Blobs_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/blob'
        }
      }), _defineProperty(_ns2Blobs_common, 'file', _defineProperty({}, config, {
        view: {
          type: UploadInput
        }
      })), _defineProperty(_ns2Blobs_common, 'name', _defineProperty({}, config, {
        cloneable: false,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.blobs_common.name.name',
            'defaultMessage': 'Name'
          }
        }),
        readOnly: true,
        view: {
          type: ReadOnlyInput
        }
      })), _defineProperty(_ns2Blobs_common, 'length', _defineProperty({}, config, {
        cloneable: false,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.blobs_common.length.name',
            'defaultMessage': 'Size'
          },
          value: {
            'id': 'field.blobs_common.length.value',
            'defaultMessage': '{value, number} bytes'
          }
        }),
        readOnly: true,
        view: {
          type: ReadOnlyInput
        }
      })), _defineProperty(_ns2Blobs_common, 'mimeType', _defineProperty({}, config, {
        cloneable: false,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.blobs_common.mimeType.name',
            'defaultMessage': 'Type'
          }
        }),
        readOnly: true,
        view: {
          type: ReadOnlyInput
        }
      })), _ns2Blobs_common)
    })
  };
};