import forEach from 'lodash/forEach';
export default (function (_ref) {
  var intlPrefix = _ref.intlPrefix,
      formatMessage = _ref.formatMessage,
      projectId = _ref.projectId;
  return {
    autoQuery: false,
    pageSize: 20,
    transport: {
      read: function read(_ref2) {
        var data = _ref2.data;
        // eslint-disable-next-line camelcase
        var share = data.share,
            search_project_id = data.search_project_id,
            param = data.param;
        var url = '';
        forEach({
          search_project_id: search_project_id,
          param: param
        }, function (value, key) {
          value && (url = "".concat(url, "&").concat(key, "=").concat(value));
        });
        return {
          url: "/devops/v1/projects/".concat(projectId, "/app_service/page_by_mode?share=").concat(share || true).concat(url),
          method: 'get'
        };
      }
    },
    fields: [{
      name: 'id',
      type: 'string'
    }, {
      name: 'name',
      type: 'string',
      label: formatMessage({
        id: "".concat(intlPrefix, ".name")
      })
    }, {
      name: 'code',
      type: 'string',
      label: formatMessage({
        id: "".concat(intlPrefix, ".code")
      })
    }, {
      name: 'type',
      type: 'string',
      label: formatMessage({
        id: "".concat(intlPrefix, ".type")
      })
    }, {
      name: 'projectName',
      type: 'string',
      label: formatMessage({
        id: "".concat(intlPrefix, ".project")
      })
    }, {
      name: 'share',
      type: 'boolean',
      label: formatMessage({
        id: "".concat(intlPrefix, ".source")
      })
    }]
  };
});