"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _reactIntl = require("react-intl");
var _default = configContext => {
  const {
    AutocompleteInput,
    CompoundInput,
    DateInput,
    IDGeneratorInput,
    OptionPickerInput,
    TextInput
  } = configContext.inputComponents;
  const {
    configKey: config
  } = configContext.configHelpers;
  const {
    DATA_TYPE_DATE
  } = configContext.dataTypes;
  const {
    extensions
  } = configContext.config;
  const {
    validateNotInUse
  } = configContext.validationHelpers;
  return {
    document: {
      [config]: {
        view: {
          type: CompoundInput,
          props: {
            defaultChildSubpath: 'ns2:movements_common'
          }
        }
      },
      ...extensions.core.fields,
      'ns2:movements_common': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/movement'
          }
        },
        movementReferenceNumber: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              inUse: {
                "id": "field.movements_common.movementReferenceNumber.inUse",
                "defaultMessage": "The reference number {value} is in use by another record."
              },
              name: {
                "id": "field.movements_common.movementReferenceNumber.name",
                "defaultMessage": "Reference number"
              }
            }),
            searchView: {
              type: TextInput
            },
            validate: validationContext => validateNotInUse({
              configContext,
              validationContext,
              fieldName: 'movements_common:movementReferenceNumber'
            }),
            view: {
              type: IDGeneratorInput,
              props: {
                source: 'inventory,location,movement'
              }
            }
          }
        },
        normalLocation: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.normalLocation.name",
                "defaultMessage": "Normal location"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'location/local,location/offsite,organization/local,organization/shared'
              }
            }
          }
        },
        currentLocation: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                "id": "field.movements_common.currentLocation.fullName",
                "defaultMessage": "Current location"
              },
              name: {
                "id": "field.movements_common.currentLocation.name",
                "defaultMessage": "Location"
              }
            }),
            required: true,
            view: {
              type: AutocompleteInput,
              props: {
                source: 'location/local,location/offsite,organization/local,organization/shared'
              }
            }
          }
        },
        currentLocationFitness: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                "id": "field.movements_common.currentLocationFitness.fullName",
                "defaultMessage": "Current location fitness"
              },
              name: {
                "id": "field.movements_common.currentLocationFitness.name",
                "defaultMessage": "Fitness"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'locationFitnesses'
              }
            }
          }
        },
        currentLocationNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                "id": "field.movements_common.currentLocationNote.fullName",
                "defaultMessage": "Current location note"
              },
              name: {
                "id": "field.movements_common.currentLocationNote.name",
                "defaultMessage": "Note"
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        locationDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.locationDate.name",
                "defaultMessage": "Location date"
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        reasonForMove: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.reasonForMove.name",
                "defaultMessage": "Reason for move"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'moveReasons'
              }
            }
          }
        },
        movementMethods: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          movementMethod: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  "id": "field.movements_common.movementMethod.name",
                  "defaultMessage": "Movement method"
                }
              }),
              repeating: true,
              view: {
                type: OptionPickerInput,
                props: {
                  source: 'moveMethods'
                }
              }
            }
          }
        },
        plannedRemovalDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.plannedRemovalDate.name",
                "defaultMessage": "Planned removal date"
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        removalDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.removalDate.name",
                "defaultMessage": "Removal date"
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        movementContact: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                "id": "field.movements_common.movementContact.fullName",
                "defaultMessage": "Movement contact"
              },
              name: {
                "id": "field.movements_common.movementContact.name",
                "defaultMessage": "Contact"
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'person/local,person/shared'
              }
            }
          }
        },
        movementNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                "id": "field.movements_common.movementNote.fullName",
                "defaultMessage": "Movement note"
              },
              name: {
                "id": "field.movements_common.movementNote.name",
                "defaultMessage": "Note"
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        inventoryActionRequired: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.inventoryActionRequired.name",
                "defaultMessage": "Inventory action required"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'invActions'
              }
            }
          }
        },
        frequencyForInventory: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.frequencyForInventory.name",
                "defaultMessage": "Inventory frequency"
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'invFreqs'
              }
            }
          }
        },
        inventoryDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.inventoryDate.name",
                "defaultMessage": "Inventory date"
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        nextInventoryDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                "id": "field.movements_common.nextInventoryDate.name",
                "defaultMessage": "Next inventory date"
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        inventoryContactList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          inventoryContact: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                fullName: {
                  "id": "field.movements_common.inventoryContact.fullName",
                  "defaultMessage": "Inventory contact"
                },
                name: {
                  "id": "field.movements_common.inventoryContact.name",
                  "defaultMessage": "Contact"
                }
              }),
              repeating: true,
              view: {
                type: AutocompleteInput,
                props: {
                  source: 'person/local,person/shared'
                }
              }
            }
          }
        },
        inventoryNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                "id": "field.movements_common.inventoryNote.fullName",
                "defaultMessage": "Inventory note"
              },
              name: {
                "id": "field.movements_common.inventoryNote.name",
                "defaultMessage": "Note"
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        }
      }
    }
  };
};
exports.default = _default;