'use strict';

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

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

exports.default = pluginContext => {
  var _pluginContext$inputC = pluginContext.inputComponents;
  const AutocompleteInput = _pluginContext$inputC.AutocompleteInput,
        CompoundInput = _pluginContext$inputC.CompoundInput,
        DateInput = _pluginContext$inputC.DateInput,
        IDGeneratorInput = _pluginContext$inputC.IDGeneratorInput,
        OptionPickerInput = _pluginContext$inputC.OptionPickerInput,
        StructuredDateInput = _pluginContext$inputC.StructuredDateInput,
        TermPickerInput = _pluginContext$inputC.TermPickerInput,
        TextInput = _pluginContext$inputC.TextInput;
  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_STRUCTURED_DATE = _pluginContext$dataTy.DATA_TYPE_STRUCTURED_DATE;
  const extensions = pluginContext.config.extensions;


  return {
    document: Object.assign({
      [config]: {
        view: {
          type: CompoundInput,
          props: {
            defaultChildSubpath: 'ns2:acquisitions_common'
          }
        }
      }
    }, extensions.core.fields, {
      'ns2:acquisitions_common': {
        [config]: {
          service: {
            ns: 'http://collectionspace.org/services/acquisition'
          }
        },
        acquisitionReferenceNumber: {
          [config]: {
            cloneable: false,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.acquisitionReferenceNumber.name',
                'defaultMessage': 'Reference number'
              }
            }),
            required: true,
            searchView: {
              type: TextInput
            },
            view: {
              type: IDGeneratorInput,
              props: {
                idGeneratorName: 'accession,archives,library'
              }
            }
          }
        },
        accessionDateGroup: Object.assign({
          [config]: {
            dataType: DATA_TYPE_STRUCTURED_DATE,
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.accessionDateGroup.name',
                'defaultMessage': 'Accession date'
              }
            }),
            searchView: {
              type: DateInput
            },
            view: {
              type: StructuredDateInput
            }
          }
        }, extensions.structuredDate.fields),
        acquisitionAuthorizer: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.acquisitionAuthorizer.name',
                'defaultMessage': 'Authorizer'
              }
            }),
            view: {
              type: AutocompleteInput,
              props: {
                source: 'person/local'
              }
            }
          }
        },
        acquisitionAuthorizerDate: {
          [config]: {
            dataType: DATA_TYPE_DATE,
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.acquisitionAuthorizerDate.fullName',
                'defaultMessage': 'Authorization date'
              },
              name: {
                'id': 'field.acquisitions_common.acquisitionAuthorizerDate.name',
                'defaultMessage': 'Date'
              }
            }),
            view: {
              type: DateInput
            }
          }
        },
        acquisitionDateGroupList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          acquisitionDateGroup: Object.assign({
            [config]: {
              dataType: DATA_TYPE_STRUCTURED_DATE,
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.acquisitions_common.acquisitionDateGroup.name',
                  'defaultMessage': 'Acquisition date'
                }
              }),
              repeating: true,
              searchView: {
                type: DateInput
              },
              view: {
                type: StructuredDateInput
              }
            }
          }, extensions.structuredDate.fields)
        },
        acquisitionMethod: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.acquisitionMethod.name',
                'defaultMessage': 'Acquisition method'
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'acquisitionMethods'
              }
            }
          }
        },
        acquisitionSources: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          acquisitionSource: {
            [config]: {
              repeating: true,
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.acquisitions_common.acquisitionSource.name',
                  'defaultMessage': 'Acquisition source'
                }
              }),
              view: {
                type: AutocompleteInput,
                props: {
                  source: 'person/local,person/shared,organization/local,organization/shared'
                }
              }
            }
          }
        },
        owners: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          owner: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.acquisitions_common.owner.name',
                  'defaultMessage': 'Owner'
                }
              }),
              repeating: true,
              view: {
                type: AutocompleteInput,
                props: {
                  source: 'person/local,person/shared,organization/local,organization/shared'
                }
              }
            }
          }
        },
        transferOfTitleNumber: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.transferOfTitleNumber.name',
                'defaultMessage': 'Transfer of title number'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        creditLine: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.creditLine.name',
                'defaultMessage': 'Credit line'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        groupPurchasePriceCurrency: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.groupPurchasePriceCurrency.fullName',
                'defaultMessage': 'Group purchase price currency'
              },
              name: {
                'id': 'field.acquisitions_common.groupPurchasePriceCurrency.name',
                'defaultMessage': 'Currency'
              }
            }),
            view: {
              type: TermPickerInput,
              props: {
                source: 'currency'
              }
            }
          }
        },
        groupPurchasePriceValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.groupPurchasePriceValue.fullName',
                'defaultMessage': 'Group purchase price value'
              },
              name: {
                'id': 'field.acquisitions_common.groupPurchasePriceValue.name',
                'defaultMessage': 'Value'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        objectOfferPriceCurrency: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.objectOfferPriceCurrency.fullName',
                'defaultMessage': 'Object offer price currency'
              },
              name: {
                'id': 'field.acquisitions_common.objectOfferPriceCurrency.name',
                'defaultMessage': 'Currency'
              }
            }),
            view: {
              type: TermPickerInput,
              props: {
                source: 'currency'
              }
            }
          }
        },
        objectOfferPriceValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.objectOfferPriceValue.fullName',
                'defaultMessage': 'Object offer price value'
              },
              name: {
                'id': 'field.acquisitions_common.objectOfferPriceValue.name',
                'defaultMessage': 'Value'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        objectPurchaseOfferPriceCurrency: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.objectPurchaseOfferPriceCurrency.fullName',
                'defaultMessage': 'Object purchaser offer price currency'
              },
              name: {
                'id': 'field.acquisitions_common.objectPurchaseOfferPriceCurrency.name',
                'defaultMessage': 'Currency'
              }
            }),
            view: {
              type: TermPickerInput,
              props: {
                source: 'currency'
              }
            }
          }
        },
        objectPurchaseOfferPriceValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.objectPurchaseOfferPriceValue.fullName',
                'defaultMessage': 'Object purchaser offer price value'
              },
              name: {
                'id': 'field.acquisitions_common.objectPurchaseOfferPriceValue.name',
                'defaultMessage': 'Value'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        objectPurchasePriceCurrency: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.objectPurchasePriceCurrency.fullName',
                'defaultMessage': 'Object purchase price currency'
              },
              name: {
                'id': 'field.acquisitions_common.objectPurchasePriceCurrency.name',
                'defaultMessage': 'Currency'
              }
            }),
            view: {
              type: TermPickerInput,
              props: {
                source: 'currency'
              }
            }
          }
        },
        objectPurchasePriceValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.objectPurchasePriceValue.fullName',
                'defaultMessage': 'Object purchase price value'
              },
              name: {
                'id': 'field.acquisitions_common.objectPurchasePriceValue.name',
                'defaultMessage': 'Value'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        originalObjectPurchasePriceCurrency: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.originalObjectPurchasePriceCurrency.fullName',
                'defaultMessage': 'Original object purchase price currency'
              },
              name: {
                'id': 'field.acquisitions_common.originalObjectPurchasePriceCurrency.name',
                'defaultMessage': 'Currency'
              }
            }),
            view: {
              type: TermPickerInput,
              props: {
                source: 'currency'
              }
            }
          }
        },
        originalObjectPurchasePriceValue: {
          [config]: {
            dataType: DATA_TYPE_FLOAT,
            messages: (0, _reactIntl.defineMessages)({
              fullName: {
                'id': 'field.acquisitions_common.originalObjectPurchasePriceValue.fullName',
                'defaultMessage': 'Original object purchase price value'
              },
              name: {
                'id': 'field.acquisitions_common.originalObjectPurchasePriceValue.name',
                'defaultMessage': 'Value'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        acquisitionReason: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.acquisitionReason.name',
                'defaultMessage': 'Acquisition reason'
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        acquisitionNote: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.acquisitionNote.name',
                'defaultMessage': 'Note'
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        acquisitionProvisos: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.acquisitions_common.acquisitionProvisos.name',
                'defaultMessage': 'Provisos'
              }
            }),
            view: {
              type: TextInput,
              props: {
                multiline: true
              }
            }
          }
        },
        acquisitionFundingList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          acquisitionFunding: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.acquisitions_common.acquisitionFunding.name',
                  'defaultMessage': 'Funding'
                }
              }),
              repeating: true,
              view: {
                type: CompoundInput,
                props: {
                  tabular: true
                }
              }
            },
            acquisitionFundingCurrency: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    'id': 'field.acquisitions_common.acquisitionFundingCurrency.fullName',
                    'defaultMessage': 'Funding currency'
                  },
                  name: {
                    'id': 'field.acquisitions_common.acquisitionFundingCurrency.name',
                    'defaultMessage': 'Currency'
                  }
                }),
                view: {
                  type: TermPickerInput,
                  props: {
                    source: 'currency'
                  }
                }
              }
            },
            acquisitionFundingValue: {
              [config]: {
                dataType: DATA_TYPE_FLOAT,
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    'id': 'field.acquisitions_common.acquisitionFundingValue.fullName',
                    'defaultMessage': 'Funding value'
                  },
                  name: {
                    'id': 'field.acquisitions_common.acquisitionFundingValue.name',
                    'defaultMessage': 'Value'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            acquisitionFundingSource: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.acquisitions_common.acquisitionFundingSource.name',
                    'defaultMessage': 'Funding source'
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'person/local,person/shared,organization/local,organization/shared'
                  }
                }
              }
            },
            acquisitionFundingSourceProvisos: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.acquistions_common.acquisitionFundingSourceProvisos.name',
                    'defaultMessage': 'Source provisos'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            }
          }
        },
        fieldCollectionEventNames: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          fieldCollectionEventName: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.acquisitions_common.fieldCollectionEventName.name',
                  'defaultMessage': 'Field collection event name'
                }
              }),
              repeating: true,
              view: {
                type: TextInput
              }
            }
          }
        }
      }
    })
  };
};