import VersionApi from "@/api/system/version";
import type { editRequest } from "@/api/system/version";
import type { IContentConfig } from "@/components/CURD/types";

const contentConfig: IContentConfig<editRequest> = {
  pageName: "sys:user",
  table: {
    border: true,
    highlightCurrentRow: true,
  },
  pagination: {
    background: true,
    layout: "prev,pager,next,jumper,total,sizes",
    pageSize: 20,
    pageSizes: [10, 20, 30, 50],
  },
  indexAction: function (params) {
    return VersionApi.getList();
  },
  modifyAction: function (data: any) {
    return VersionApi.edit(data);
  },
  deleteAction: VersionApi.delete,
  // modifyAction: function (data) {
  //   // return VersionApi.edit(data);
  // },
  pk: "id",
  toolbar: ["add"],
  defaultToolbar: ["refresh", "filter", "search"],
  cols: [
    { type: "selection", width: 50, align: "center" },
    { label: "id", align: "center", prop: "id", width: 100, show: true },
    {
      label: "渠道",
      align: "center",
      prop: "source",
      width: 120,
      templet: "custom",
      slotName: "options",
    },
    {
      label: "类型",
      align: "center",
      prop: "type",
      width: 120,
      templet: "custom",
      slotName: "options",
    },
    {
      label: "版本号",
      align: "center",
      width: 120,
      prop: "version",
    },

    {
      label: "是否强制升级",
      align: "center",
      prop: "isForce",
      width: 120,
      templet: "switch",
      slotName: "isForce",
    },
    {
      label: "更新内容",
      align: "center",
      prop: "message",
      width: 240,
    },
    {
      label: "下载地址",
      align: "center",
      prop: "url",
      templet: "url",
      slotName: "url",
    },
    {
      label: "操作",
      align: "center",
      fixed: "right",
      width: 280,
      templet: "tool",
      operat: ["edit", "delete"],
    },
  ],
};

export default contentConfig;
