import { ContentConfig } from "/@/components/PageContent";
import {
  httpList,
  httpDelete,
  httpUpdate,
  httpStatus
} from "/@/api/interest/group";
import { renderStatus } from "/@/utils/column-helper";
import { shareTypeOptions } from "./_options";
import { STATUS_OPTIONS } from "/@/config/status";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },
  {
    label: "序号",
    type: "index",
    width: 70,
    hide: ({ checkList }) => !checkList.includes("序号列")
  },
  {
    prop: "title",
    label: "用户组名称"
  },
  {
    prop: "nickname",
    label: "成员"
  },
  {
    prop: "remark",
    label: "备注"
  },
  {
    prop: "type",
    label: "共享类型",
    ...renderStatus(shareTypeOptions, "type")
  },
  {
    prop: "status",
    label: "状态",
    ...renderStatus(STATUS_OPTIONS)
  },
  {
    prop: "creater",
    label: "创建人"
  },
  {
    prop: "addtime",
    label: "创建时间",
    sortable: true
  },
  {
    label: "操作",
    fixed: "right",
    width: 60,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "用户组",
  columns,
  apis: {
    httpList,
    httpDelete,
    httpUpdate,
    httpStatus
  }
};

export default contentConfig;
