'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,
        DateInput = _pluginContext$inputC.DateInput,
        OptionPickerInput = _pluginContext$inputC.OptionPickerInput,
        TextInput = _pluginContext$inputC.TextInput,
        AutocompleteInput = _pluginContext$inputC.AutocompleteInput,
        IDGeneratorInput = _pluginContext$inputC.IDGeneratorInput,
        TermPickerInput = _pluginContext$inputC.TermPickerInput,
        StructuredDateInput = _pluginContext$inputC.StructuredDateInput;
  const config = pluginContext.configHelpers.configKey;
  var _pluginContext$dataTy = pluginContext.dataTypes;
  const DATA_TYPE_DATE = _pluginContext$dataTy.DATA_TYPE_DATE,
        DATA_TYPE_FLOAT = _pluginContext$dataTy.DATA_TYPE_FLOAT,
        DATA_TYPE_INT = _pluginContext$dataTy.DATA_TYPE_INT,
        DATA_TYPE_STRUCTURED_DATE = _pluginContext$dataTy.DATA_TYPE_STRUCTURED_DATE;
  const extensions = pluginContext.config.extensions;


  return {
    document: Object.assign({
      [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: {
                idGeneratorName: 'objectexit'
              }
            }
          }
        },
        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'
              }
            }
          }
        },
        exitDateGroup: Object.assign({
          [config]: {
            dataType: DATA_TYPE_STRUCTURED_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.exitDateGroup.name',
                'defaultMessage': 'Exit date'
              }
            }),
            searchView: {
              type: DateInput
            },
            view: {
              type: StructuredDateInput
            }
          }
        }, extensions.structuredDate.fields),
        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
            }
          }
        },
        exitNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.exitNote.name',
                'defaultMessage': 'Exit note'
              }
            }),
            searchView: {
              type: TextInput
            },
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        exitReason: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.exitReason.name',
                'defaultMessage': 'Exit reason'
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'exitReasons'
              }
            }
          }
        },
        packingNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.packingNote.name',
                'defaultMessage': 'Packing note'
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        disposalNewObjectNumber: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.disposalNewObjectNumber.name',
                'defaultMessage': 'Disposal new object number'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        deacApprovalGroupList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          deacApprovalGroup: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.objectexit_common.deacApprovalGroupList.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'
                  }
                }
              }
            },
            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)({
                  name: {
                    'id': 'field.objectexit_common.deaccessionApprovalDate.name',
                    'defaultMessage': 'Date'
                  },
                  fullName: {
                    'id': 'field.objectexit_common.deaccessionApprovalDate.fullName',
                    'defaultMessage': 'Deaccession approval status date'
                  }
                }),
                view: {
                  type: DateInput
                }
              }
            }
          }
        },
        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
            }
          }
        },
        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'
              }
            }
          }
        },
        disposalReason: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.disposalReason.name',
                'defaultMessage': 'Disposal reason'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        disposalProvisos: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.disposalProvisos.name',
                'defaultMessage': 'Disposal provisos'
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        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'
              }
            }
          }
        },
        disposalNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.disposalNote.name',
                'defaultMessage': 'Disposal note'
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        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'
              }
            }
          }
        },
        disposalValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.disposalValue.name',
                'defaultMessage': 'Value'
              },
              fullName: {
                'id': 'field.objectexit_common.disposalValue.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'
              }
            }
          }
        },
        groupDisposalValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.objectexit_common.groupDisposalValue.name',
                'defaultMessage': 'Value'
              },
              fullName: {
                'id': 'field.objectexit_common.groupDisposalValue.fullName',
                'defaultMessage': 'Group disposal value'
              }
            }),
            view: {
              type: TextInput
            }
          }
        }
      }
    })
  };
};