export default (function (_ref) {
  var intlPrefix = _ref.intlPrefix,
      formatMessage = _ref.formatMessage,
      appServiceDs = _ref.appServiceDs,
      objectTypeDs = _ref.objectTypeDs,
      chartsDs = _ref.chartsDs,
      defaultObjectType = _ref.defaultObjectType;

  function handleUpdate(_ref2) {
    var name = _ref2.name,
        value = _ref2.value;
    chartsDs.setQueryParameter(name, value);
    chartsDs.query();
  }

  return {
    autoCreate: true,
    fields: [{
      name: 'appServiceId',
      type: 'string',
      textField: 'name',
      valueField: 'id',
      label: formatMessage({
        id: 'chooseApp'
      }),
      options: appServiceDs
    }, {
      name: 'objectType',
      type: 'string',
      defaultValue: defaultObjectType,
      textField: 'text',
      valueField: 'value',
      label: formatMessage({
        id: 'report.code-quality.type'
      }),
      options: objectTypeDs
    }],
    events: {
      update: handleUpdate
    }
  };
});