"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,
    DateInput,
    OptionPickerInput,
    TextInput,
    AutocompleteInput,
    IDGeneratorInput,
    TermPickerInput,
    StructuredDateInput
  } = configContext.inputComponents;
  const {
    configKey: config
  } = configContext.configHelpers;
  const {
    DATA_TYPE_DATE,
    DATA_TYPE_FLOAT,
    DATA_TYPE_INT,
    DATA_TYPE_STRUCTURED_DATE
  } = configContext.dataTypes;
  const {
    extensions
  } = configContext.config;
  return {
    document: _objectSpread({
      [config]: {
        view: {
          type: CompoundInput,
          props: {
            defaultChildSubpath: 'ns2:objectexit_common'
          }
        }
      }
    }, extensions.core.fields, {
      'ns2:objectexit_common': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/objectexit'
          }
        },
        exitNumber: {
          [config]: {
            cloneable: false,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.exitNumber.name",
                "defaultMessage": "Exit number"
              }
            }),
            required: true,
            searchView: {
              type: TextInput
            },
            view: {
              type: IDGeneratorInput,
              props: {
                source: 'objectexit'
              }
            }
          }
        },
        exitDateGroup: _objectSpread({
          [config]: {
            dataType: DATA_TYPE_STRUCTURED_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.exitDateGroup.name",
                "defaultMessage": "Exit date"
              }
            }),
            view: {
              type: StructuredDateInput
            }
          }
        }, extensions.structuredDate.fields),
        exitReason: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.exitReason.name",
                "defaultMessage": "Exit reason"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'exitReasons'
              }
            }
          }
        },
        exitMethods: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          exitMethod: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  "id": "field.objectexit_common.exitMethod.name",
                  "defaultMessage": "Exit method"
                }
              }),
              repeating: true,
              view: {
                type: OptionPickerInput,
                props: {
                  source: 'exitMethods'
                }
              }
            }
          }
        },
        exitQuantity: {
          [config]: {
            dataType: DATA_TYPE_INT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.exitQuantity.name",
                "defaultMessage": "Exit quantity"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        currentOwner: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.currentOwner.name",
                "defaultMessage": "Current owner"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'person/local,person/shared,organization/local,organization/shared'
              }
            }
          }
        },
        depositor: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.depositor.name",
                "defaultMessage": "Depositor"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'person/local,person/shared,organization/local,organization/shared'
              }
            }
          }
        },
        exitNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.exitNote.name",
                "defaultMessage": "Exit note"
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        packingNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.packingNote.name",
                "defaultMessage": "Packing note"
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        displosalNewObjectNumber: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.displosalNewObjectNumber.name",
                "defaultMessage": "Disposal new object number"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        deaccessionAuthorizer: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.deaccessionAuthorizer.name",
                "defaultMessage": "Deaccession authorizer"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'person/local'
              }
            }
          }
        },
        authorizationDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.authorizationDate.name",
                "defaultMessage": "Authorization date"
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        deacApprovalGroupList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          deacApprovalGroup: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  "id": "field.objectexit_common.deacApprovalGroup.name",
                  "defaultMessage": "Deaccession approval"
                }
              }),
              repeating: true,
              view: {
                type: CompoundInput,
                props: {
                  tabular: true
                }
              }
            },
            deaccessionApprovalGroup: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.objectexit_common.deaccessionApprovalGroup.fullName",
                    "defaultMessage": "Deaccession approval group"
                  },
                  name: {
                    "id": "field.objectexit_common.deaccessionApprovalGroup.name",
                    "defaultMessage": "Group"
                  }
                }),
                view: {
                  type: TermPickerInput,
                  props: {
                    source: 'deaccessionapprovalgroup'
                  }
                }
              }
            },
            deaccessionApprovalIndividual: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.objectexit_common.deaccessionApprovalIndividual.fullName",
                    "defaultMessage": "Deaccession approval individual"
                  },
                  name: {
                    "id": "field.objectexit_common.deaccessionApprovalIndividual.name",
                    "defaultMessage": "Individual"
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'person/local'
                  }
                }
              }
            },
            deaccessionApprovalStatus: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.objectexit_common.deaccessionApprovalStatus.fullName",
                    "defaultMessage": "Deaccession approval status"
                  },
                  name: {
                    "id": "field.objectexit_common.deaccessionApprovalStatus.name",
                    "defaultMessage": "Status"
                  }
                }),
                view: {
                  type: TermPickerInput,
                  props: {
                    source: 'deaccessionapprovalstatus'
                  }
                }
              }
            },
            deaccessionApprovalDate: {
              [config]: {
                dataType: DATA_TYPE_DATE,
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.objectexit_common.deaccessionApprovalDate.fullName",
                    "defaultMessage": "Deaccession approval status date"
                  },
                  name: {
                    "id": "field.objectexit_common.deaccessionApprovalDate.name",
                    "defaultMessage": "Date"
                  }
                }),
                view: {
                  type: DateInput
                }
              }
            },
            deaccessionApprovalNote: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    "id": "field.objectexit_common.deaccessionApprovalNote.fullName",
                    "defaultMessage": "Deaccession approval note"
                  },
                  name: {
                    "id": "field.objectexit_common.deaccessionApprovalNote.name",
                    "defaultMessage": "Note"
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            }
          }
        },
        deaccessionDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.deaccessionDate.name",
                "defaultMessage": "Deaccession date"
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        disposalDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.disposalDate.name",
                "defaultMessage": "Disposal date"
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        disposalMethod: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.disposalMethod.name",
                "defaultMessage": "Disposal method"
              }
            }),
            view: {
              type: TermPickerInput,
              props: {
                source: 'disposalmethod'
              }
            }
          }
        },
        displosalReason: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.displosalReason.name",
                "defaultMessage": "Disposal reason"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        disposalProposedRecipient: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.disposalProposedRecipient.name",
                "defaultMessage": "Disposal proposed recipient"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'person/local,person/shared,organization/local,organization/shared'
              }
            }
          }
        },
        disposalRecipient: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.disposalRecipient.name",
                "defaultMessage": "Disposal recipient"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'person/local,person/shared,organization/local,organization/shared'
              }
            }
          }
        },
        disposalCurrency: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                "id": "field.objectexit_common.disposalCurrency.fullName",
                "defaultMessage": "Disposal currency"
              },
              name: {
                "id": "field.objectexit_common.disposalCurrency.name",
                "defaultMessage": "Currency"
              }
            }),
            view: {
              type: TermPickerInput,
              props: {
                source: 'currency'
              }
            }
          }
        },
        displosalValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.displosalValue.name",
                "defaultMessage": "Value"
              },
              fullName: {
                "id": "field.objectexit_common.displosalValue.fullName",
                "defaultMessage": "Disposal value"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        groupDisposalCurrency: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                "id": "field.objectexit_common.groupDisposalCurrency.fullName",
                "defaultMessage": "Group disposal currency"
              },
              name: {
                "id": "field.objectexit_common.groupDisposalCurrency.name",
                "defaultMessage": "Currency"
              }
            }),
            view: {
              type: TermPickerInput,
              props: {
                source: 'currency'
              }
            }
          }
        },
        groupDisplosalValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.groupDisplosalValue.name",
                "defaultMessage": "Value"
              },
              fullName: {
                "id": "field.objectexit_common.groupDisposalValue.fullName",
                "defaultMessage": "Group disposal value"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        displosalProvisos: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.displosalProvisos.name",
                "defaultMessage": "Disposal provisos"
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        displosalNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.objectexit_common.displosalNote.name",
                "defaultMessage": "Disposal note"
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        }
      }
    })
  };
};

exports.default = _default;