'use strict';

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

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

exports.default = pluginContext => {
  var _pluginContext$inputC = pluginContext.inputComponents;
  const CompoundInput = _pluginContext$inputC.CompoundInput,
        TextInput = _pluginContext$inputC.TextInput,
        UploadInput = _pluginContext$inputC.UploadInput;
  const config = pluginContext.configHelpers.configKey;
  const extensions = pluginContext.config.extensions;


  return {
    document: Object.assign({
      [config]: {
        view: {
          type: CompoundInput,
          props: {
            defaultChildSubpath: 'ns2:blobs_common'
          }
        }
      }
    }, extensions.core.fields, {
      'ns2:blobs_common': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/blob'
          }
        },
        file: {
          [config]: {
            view: {
              type: UploadInput
            }
          }
        },
        name: {
          [config]: {
            cloneable: false,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.blobs_common.name.name',
                'defaultMessage': 'Name'
              }
            }),
            view: {
              type: TextInput,
              props: {
                readOnly: true
              }
            }
          }
        },
        length: {
          [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'
              }
            }),
            view: {
              type: TextInput,
              props: {
                readOnly: true
              }
            }
          }
        },
        mimeType: {
          [config]: {
            cloneable: false,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.blobs_common.mimeType.name',
                'defaultMessage': 'Type'
              }
            }),
            view: {
              type: TextInput,
              props: {
                readOnly: true
              }
            }
          }
        }
      }
    })
  };
};