'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,
        OptionPickerInput = _pluginContext$inputC.OptionPickerInput,
        TextInput = _pluginContext$inputC.TextInput,
        WorkflowStateInput = _pluginContext$inputC.WorkflowStateInput;
  const config = pluginContext.configHelpers.configKey;
  const extensions = pluginContext.config.extensions;


  return {
    document: Object.assign({
      [config]: {
        view: {
          type: CompoundInput,
          props: {
            defaultChildSubpath: 'ns2:vocabularies_common'
          }
        }
      }
    }, extensions.core.fields, {
      'ns2:vocabularies_common': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/vocabulary'
          },
          view: {
            type: CompoundInput
          }
        },
        displayName: {
          [config]: {
            cloneable: false,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.vocabularies_common.displayName.name',
                'defaultMessage': 'Name'
              }
            }),
            required: true,
            view: {
              type: TextInput
            }
          }
        },
        source: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.vocabularies_common.source.name',
                'defaultMessage': 'Source'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        description: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.vocabularies_common.description.name',
                'defaultMessage': 'Description'
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        }
      },
      'ns2:abstract-common-list': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/jaxb'
          },
          view: {
            type: CompoundInput
          }
        },
        'list-item': {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.vocabularyitems_common.list-item.name',
                'defaultMessage': 'Terms'
              }
            }),
            repeating: true,
            view: {
              type: CompoundInput,
              props: {
                tabular: true,
                sortableFields: {
                  displayName: true
                }
              }
            }
          },
          displayName: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.vocabularyitems_common.displayName.name',
                  'defaultMessage': 'Name'
                },
                fullName: {
                  'id': 'field.vocabularyitems_common.displayName.fullName',
                  'defaultMessage': 'Term name'
                }
              }),
              required: true,
              view: {
                type: TextInput
              }
            }
          },
          description: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.vocabularyitems_common.description.name',
                  'defaultMessage': 'Description'
                }
              }),
              view: {
                type: TextInput
              }
            }
          },
          source: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.vocabularyitems_common.source.name',
                  'defaultMessage': 'Source'
                }
              }),
              view: {
                type: TextInput
              }
            }
          },
          sourcePage: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.vocabularyitems_common.sourcePage.name',
                  'defaultMessage': 'Source page'
                }
              }),
              view: {
                type: TextInput
              }
            }
          },
          termStatus: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.vocabularyitems_common.termStatus.name',
                  'defaultMessage': 'Status'
                }
              }),
              view: {
                type: OptionPickerInput,
                props: {
                  source: 'vocabTermStatuses'
                }
              }
            }
          },
          workflowState: {
            [config]: {
              view: {
                type: WorkflowStateInput
              }
            }
          }
        }
      }
    })
  };
};