'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,
        OptionPickerInput = _pluginContext$inputC.OptionPickerInput,
        TextInput = _pluginContext$inputC.TextInput;
  const config = pluginContext.configHelpers.configKey;
  var _pluginContext$dataTy = pluginContext.dataTypes;
  const DATA_TYPE_FLOAT = _pluginContext$dataTy.DATA_TYPE_FLOAT,
        DATA_TYPE_DATE = _pluginContext$dataTy.DATA_TYPE_DATE;


  return {
    measuredPartGroupList: {
      [config]: {
        view: {
          type: CompoundInput
        }
      },
      measuredPartGroup: {
        [config]: {
          messages: (0, _reactIntl.defineMessages)({
            name: {
              'id': 'field.ext.dimension.measuredPartGroup.name',
              'defaultMessage': 'Dimensions'
            }
          }),
          repeating: true,
          view: {
            type: CompoundInput
          }
        },
        measuredPart: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.ext.dimension.measuredPart.name',
                'defaultMessage': 'Part'
              }
            }),
            view: {
              type: OptionPickerInput,
              props: {
                source: 'measuredParts'
              }
            }
          }
        },
        dimensionSummary: {
          [config]: {
            messages: (0, _reactIntl.defineMessages)({
              name: {
                'id': 'field.ext.dimension.dimensionSummary.name',
                'defaultMessage': 'Summary'
              }
            }),
            view: {
              type: TextInput
            }
          }
        },
        dimensionSubGroupList: {
          [config]: {
            view: {
              type: CompoundInput
            }
          },
          dimensionSubGroup: {
            [config]: {
              messages: (0, _reactIntl.defineMessages)({
                name: {
                  'id': 'field.ext.dimension.dimensionSubGroup.name',
                  'defaultMessage': 'Measurement'
                }
              }),
              repeating: true,
              view: {
                type: CompoundInput,
                props: {
                  tabular: true
                }
              }
            },
            dimension: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.ext.dimension.dimension.name',
                    'defaultMessage': 'Dimension'
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'dimensions'
                  }
                }
              }
            },
            measuredBy: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.ext.dimension.measuredBy.name',
                    'defaultMessage': 'Measured by'
                  }
                }),
                view: {
                  type: AutocompleteInput,
                  props: {
                    source: 'person/local,person/shared,organization/local,organization/shared'
                  }
                }
              }
            },
            measurementMethod: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.ext.dimension.measurementMethod.name',
                    'defaultMessage': 'Method'
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'measurementMethods'
                  }
                }
              }
            },
            value: {
              [config]: {
                dataType: DATA_TYPE_FLOAT,
                messages: (0, _reactIntl.defineMessages)({
                  fullName: {
                    'id': 'field.ext.dimension.value.fullName',
                    'defaultMessage': 'Measurement value'
                  },
                  name: {
                    'id': 'field.ext.dimension.value.name',
                    'defaultMessage': 'Value'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            measurementUnit: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.ext.dimension.measurementUnit.name',
                    'defaultMessage': 'Unit'
                  }
                }),
                view: {
                  type: OptionPickerInput,
                  props: {
                    source: 'measurementUnits'
                  }
                }
              }
            },
            valueQualifier: {
              [config]: {
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.ext.dimension.valueQualifier.name',
                    'defaultMessage': 'Qualifier'
                  }
                }),
                view: {
                  type: TextInput
                }
              }
            },
            valueDate: {
              [config]: {
                dataType: DATA_TYPE_DATE,
                messages: (0, _reactIntl.defineMessages)({
                  name: {
                    'id': 'field.ext.dimension.valueDate.name',
                    'defaultMessage': 'Date'
                  },
                  fullName: {
                    'id': 'field.ext.dimension.valueDate.fullName',
                    'defaultMessage': 'Measurement date'
                  }
                }),
                view: {
                  type: DateInput
                }
              }
            }
          }
        }
      }
    }
  };
};