'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

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

var _coreFields = require('../../../helpers/coreFields');

var _coreFields2 = _interopRequireDefault(_coreFields);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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

exports.default = function (pluginContext) {
  var _loanStatusGroup, _loanStatusGroupList, _ns2Loansout_common;

  var _pluginContext$inputC = pluginContext.inputComponents,
      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;
  var config = pluginContext.configHelpers.configKey;
  var DATA_TYPE_DATE = pluginContext.dataTypes.DATA_TYPE_DATE;


  var coreFields = (0, _coreFields2.default)(pluginContext);

  return {
    document: Object.assign(_defineProperty({}, config, {
      view: {
        type: CompoundInput,
        props: {
          defaultChildSubpath: 'ns2:loansout_common'
        }
      }
    }), coreFields, {
      'ns2:loansout_common': (_ns2Loansout_common = {}, _defineProperty(_ns2Loansout_common, config, {
        service: {
          ns: 'http://collectionspace.org/services/loanout'
        }
      }), _defineProperty(_ns2Loansout_common, 'loanOutNumber', _defineProperty({}, config, {
        cloneable: false,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanOutNumber.name',
            'defaultMessage': 'Loan out number'
          }
        }),
        required: true,
        searchView: {
          type: TextInput
        },
        view: {
          type: IDGeneratorInput,
          props: {
            idGeneratorName: 'loanout'
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'loanPurpose', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanPurpose.name',
            'defaultMessage': 'Loan purpose'
          }
        }),
        view: {
          type: OptionPickerInput,
          props: {
            source: 'loanPurposes'
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'lendersAuthorizer', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.lendersAuthorizer.name',
            'defaultMessage': 'Authorizer'
          },
          fullName: {
            'id': 'field.loansout_common.lendersAuthorizer.fullName',
            'defaultMessage': 'Lender authorizer'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared'
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'lendersContact', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.lendersContact.name',
            'defaultMessage': 'Contact'
          },
          fullName: {
            'id': 'field.loansout_common.lendersContact.fullName',
            'defaultMessage': 'Lender contact'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared'
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'lendersAuthorizationDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.lendersAuthorizationDate.name',
            'defaultMessage': 'Authorization date'
          },
          fullName: {
            'id': 'field.loansout_common.lendersAuthorizationDate.fullName',
            'defaultMessage': 'Lender authorization date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Loansout_common, 'borrower', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.borrower.name',
            'defaultMessage': 'Name'
          },
          fullName: {
            'id': 'field.loansout_common.borrower.fullName',
            'defaultMessage': 'Borrower name'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared,organization/local,organization/shared'
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'borrowersContact', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.borrowersContact.name',
            'defaultMessage': 'Contact'
          },
          fullName: {
            'id': 'field.loansout_common.borrowersContact.fullName',
            'defaultMessage': 'Borrower contact'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared'
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'borrowersAuthorizer', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.borrowersAuthorizer.name',
            'defaultMessage': 'Authorizer'
          },
          fullName: {
            'id': 'field.loansout_common.borrowersAuthorizer.fullName',
            'defaultMessage': 'Borrower authorizer'
          }
        }),
        view: {
          type: AutocompleteInput,
          props: {
            source: 'person/local,person/shared'
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'borrowersAuthorizationDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.borrowersAuthorizationDate.name',
            'defaultMessage': 'Authorization date'
          },
          fullName: {
            'id': 'field.loansout_common.borrowersAuthorizationDate.fullName',
            'defaultMessage': 'Borrower authorization date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Loansout_common, 'specialConditionsOfLoan', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.specialConditionsOfLoan.name',
            'defaultMessage': 'Conditions of loan'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'loanOutNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanOutNote.name',
            'defaultMessage': 'Note'
          }
        }),
        view: {
          type: TextInput,
          props: {
            multiline: true
          }
        }
      })), _defineProperty(_ns2Loansout_common, 'loanStatusGroupList', (_loanStatusGroupList = {}, _defineProperty(_loanStatusGroupList, config, {
        view: {
          type: CompoundInput
        }
      }), _defineProperty(_loanStatusGroupList, 'loanStatusGroup', (_loanStatusGroup = {}, _defineProperty(_loanStatusGroup, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanStatusGroup.name',
            'defaultMessage': 'Loan status'
          }
        }),
        repeating: true,
        view: {
          type: CompoundInput,
          props: {
            tabular: true
          }
        }
      }), _defineProperty(_loanStatusGroup, 'loanStatus', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanStatus.name',
            'defaultMessage': 'Status'
          },
          fullName: {
            'id': 'field.loansout_common.loanStatus.fullName',
            'defaultMessage': 'Loan status'
          }
        }),
        view: {
          type: TermPickerInput,
          props: {
            source: 'loanoutstatus'
          }
        }
      })), _defineProperty(_loanStatusGroup, 'loanStatusDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanStatusDate.name',
            'defaultMessage': 'Date'
          },
          fullName: {
            'id': 'field.loansout_common.loanStatusDate.fullName',
            'defaultMessage': 'Loan status date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_loanStatusGroup, 'loanStatusNote', _defineProperty({}, config, {
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanStatusNote.name',
            'defaultMessage': 'Note'
          }
        }),
        view: {
          type: TextInput
        }
      })), _loanStatusGroup)), _loanStatusGroupList)), _defineProperty(_ns2Loansout_common, 'loanOutDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanOutDate.name',
            'defaultMessage': 'Loan out date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Loansout_common, 'loanReturnDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanReturnDate.name',
            'defaultMessage': 'Loan return date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _defineProperty(_ns2Loansout_common, 'loanRenewalApplicationDate', _defineProperty({}, config, {
        dataType: DATA_TYPE_DATE,
        messages: (0, _reactIntl.defineMessages)({
          name: {
            'id': 'field.loansout_common.loanRenewalApplicationDate.name',
            'defaultMessage': 'Loan renewal application date'
          }
        }),
        view: {
          type: DateInput
        }
      })), _ns2Loansout_common)
    })
  };
};