"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

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

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

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; }

var _default = configContext => {
  const {
    CompoundInput,
    OptionPickerInput,
    TextInput,
    AutocompleteInput
  } = configContext.inputComponents;
  const {
    configKey: config
  } = configContext.configHelpers;
  const {
    DATA_TYPE_INT
  } = configContext.dataTypes;
  const {
    extensions
  } = configContext.config;
  return {
    document: _objectSpread({
      [config]: {
        view: {
          type: CompoundInput,
          props: {
            defaultChildSubpath: 'ns2:pottags_common'
          }
        }
      }
    }, extensions.core.fields, {
      'ns2:pottags_common': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/pottag'
          }
        },
        family: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.pottags_common.family.name",
                "defaultMessage": "Family"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'taxon/local'
              }
            }
          }
        },
        commonName: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.pottags_common.commonName.name",
                "defaultMessage": "Common name"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        locale: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.pottags_common.locale.name",
                "defaultMessage": "Country name/locale"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        taxonName: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.pottags_common.taxonName.name",
                "defaultMessage": "Taxon name"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'taxon/local'
              }
            }
          }
        },
        labelData: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.pottags_common.labelData.name",
                "defaultMessage": "Label data"
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        numberOfLabels: {
          [config]: {
            dataType: DATA_TYPE_INT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.pottags_common.numberOfLabels.name",
                "defaultMessage": "Number of labels"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        printLabels: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.pottags_common.printLabels.name",
                "defaultMessage": "Print labels"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'printLabelOptions'
              }
            }
          }
        }
      }
    })
  };
};

exports.default = _default;