import { ModelConfig } from "../.types";
import { pageActions, PAGE_SIZE } from "./_common";

export const Role: ModelConfig = {
  metadata: {
    nameKeys: ["userid"],
    pageActions,
  },
  table: {
    toolbar: {
      searchBar: {
        fields: ["userid", "username"],
        containsFields: ["userid", "username"],
        placeholder: "userid, username",
      },
      actions: [
        { action: "REFRESH", desc: "Refresh" },
        { action: "SETTING", desc: "Setting" },
        {
          action: "EXPORT",
          desc: "export",
          fields: ["*", "!create_time"],
        },
      ],
    },
    header: {
      filter: [],
      sorter: ["id", "userid"],
    },
    fields: ["*", "!create_time"],
    rowSelection: {
      actions: [
        { action: "INSERT", desc: "Insert" },
        { action: "DELETE", desc: "Delete" },
        { action: "EXPORT", desc: "Export" },
      ],
    },
    rowActions: {
      visibleNum: 2,
      actions: [
        {
          action: "EDIT",
          desc: "Edit",
        },
        { action: "DELETE", desc: "Delete" },
      ],
    },
    params: {
      pageSize: PAGE_SIZE,
    },
  },
  form: {
    fields: ["*", "!id", "!creator", "!create_time", "!update_time"],
  },
  show: {
    fields: ["*"],
  },
};
