import Api from "@/api/notifications";
import type { IContentConfig } from "@/components/CURD/types";

const contentConfig: IContentConfig = {
  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 Api.getList(params);
  },
  deleteAction: function (id) {
    return Api.delete(id);
  },
  modifyAction: function (data) {
    return Api.edit(data);
  },
  indexActionData: {},
  pk: "id",
  toolbar: [
    {
      text: "全部已读",
      name: "mark_all_read",
      auth: "",
      type: "primary",
    },
    {
      text: "清空已读",
      name: "Clear_Read",
      auth: "",
      type: "danger",
    },
  ],
  defaultToolbar: ["refresh", "filter", "search"],
  cols: [
    // { type: "selection", width: 50, align: "center" },
    {
      label: "通知类型",
      align: "center",
      prop: "title",
    },
    {
      label: "是否已读",
      align: "center",
      prop: "isRead",
      slotName: "isRead",
      templet: "custom",
    },
    {
      label: "消息内容",
      align: "center",
      prop: "content",
      slotName: "content",
      templet: "custom",
    },
    {
      label: "创建时间",
      align: "center",
      prop: "createTime",
    },
    {
      label: "操作",
      align: "center",
      fixed: "right",
      width: 280,
      templet: "custom",
      slotName: "operate",
      operat: ["delete"],
    },
    // {
    //   label: "操作",
    //   align: "center",
    //   fixed: "right",
    //   width: 150,
    //   templet: "custom",
    //   slotName: "operate",
    // },
  ],
};

export default contentConfig;
