import { IModelsConfig, PageActions } from "./.types";

const PAGE_SIZE = 10;

export const pageActions: PageActions = {
  hasDetailPage: true,
  editOnNewPage: true,
  detailOnNewPage: true,
  createOnNewPage: true,
};

export const modelsConfig: IModelsConfig = {
  Game: {
    metadata: {
      nameKeys: ["id"],
      pageActions,
    },
    table: {
      toolbar: {
        searchBar: {
          fields: ["unified_editionid", "name"],
          containsFields: ["name"],
          placeholder: "unified_editionid,name",
        },
        actions: [
          { action: "REFRESH", desc: "Refresh" },
          { action: "SETTING", desc: "Setting" },
          {
            action: "EXPORT",
            desc: "export",
            fields: ["*", "!create_time"],
          },
        ],
      },
      header: {
        filter: [],
        sorter: ["id"],
      },
      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", "!create_time", "!update_time", "!creator"],
    },
    show: {
      fields: ["*", "!create_time"],
    },
  },
  Role: {
    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: ["*"],
    },
  },
  Log: {
    metadata: {
      nameKeys: ["id"],
      pageActions,
    },
    table: {
      toolbar: {
        searchBar: {
          fields: ["resourceId", "creator"],
          containsFields: [],
          placeholder: "resourceId, creator",
        },
        actions: [
          { action: "REFRESH", desc: "Refresh" },
          { action: "SETTING", desc: "Setting" },
          {
            action: "EXPORT",
            desc: "export",
            fields: ["*"],
          },
        ],
      },
      header: {
        filter: [],
        sorter: ["id"],
      },
      fields: ["*", "!authorId", "!authorName", "!data", "!previousData"],
      rowSelection: {
        actions: [{ action: "EXPORT", desc: "Export" }],
      },
      rowActions: {
        visibleNum: 2,
        actions: [],
      },
      params: {
        pageSize: PAGE_SIZE,
      },
    },
    form: {
      fields: ["*", "!creator", "!timestamp"],
      reaction: {
        id: {
          toggle: [],
          defaultProps: {
            hidden: true,
          },
        },
      },
    },
    show: {
      fields: ["*"],
    },
  },
  Source: {
    metadata: {
      nameKeys: ["id"],
      pageActions,
    },
    table: {
      toolbar: {
        searchBar: {
          fields: ["id"],
          containsFields: [],
          placeholder: "id",
        },
        actions: [
          { action: "REFRESH", desc: "Refresh" },
          { action: "SETTING", desc: "Setting" },
          {
            action: "EXPORT",
            desc: "export",
            fields: ["*", "!create_time"],
          },
        ],
      },
      header: {
        filter: ["platform"],
        sorter: ["id", "platform"],
      },
      fields: ["*", "!create_time"],
      rowSelection: {
        actions: [
          { action: "INSERT", desc: "Insert" },
          {
            action: "CHANGE_STATUS",
            desc: "Steam",
            values: { platform: "steam" },
          },
          { action: "DELETE", desc: "Delete" },
          { action: "EXPORT", desc: "Export" },
        ],
      },
      rowActions: {
        visibleNum: 2,
        actions: [
          {
            action: "EDIT",
            desc: "Edit",
          },
          {
            action: "CHANGE_STATUS",
            desc: "Steam",
            values: { platform: "steam" },
          },
          { action: "DELETE", desc: "Delete" },
        ],
      },
      params: {
        pageSize: PAGE_SIZE,
      },
    },
    form: {
      fields: ["*", "!game_id", "!creator", "!create_time", "!update_time"],
      reaction: {
        id: {
          toggle: [],
          defaultProps: {
            hidden: true,
          },
        },
      },
    },
    show: {
      fields: ["*", "!create_time"],
    },
  },
  Tasklog: {
    metadata: {
      nameKeys: ["id"],
      pageActions,
    },
    table: {
      toolbar: {
        searchBar: {
          fields: ["id"],
          containsFields: [],
          placeholder: "id",
        },
        actions: [
          { action: "REFRESH", desc: "Refresh" },
          { action: "SETTING", desc: "Setting" },
          {
            action: "EXPORT",
            desc: "export",
            fields: ["*", "!create_time"],
          },
        ],
      },
      header: {
        filter: ["platform"],
        sorter: ["id", "platform"],
      },
      fields: ["*", "!create_time"],
      rowSelection: {
        actions: [
          { action: "INSERT", desc: "Insert" },
          {
            action: "CHANGE_STATUS",
            desc: "Steam",
            values: { platform: "steam" },
          },
          { action: "DELETE", desc: "Delete" },
          { action: "EXPORT", desc: "Export" },
        ],
      },
      rowActions: {
        visibleNum: 2,
        actions: [
          {
            action: "EDIT",
            desc: "Edit",
          },
          {
            action: "CHANGE_STATUS",
            desc: "Steam",
            values: { platform: "steam" },
          },
          { action: "DELETE", desc: "Delete" },
        ],
      },
      params: {
        pageSize: PAGE_SIZE,
      },
    },
    form: {
      fields: ["*", "!game_id", "!creator", "!create_time", "!update_time"],
      reaction: {
        id: {
          toggle: [],
          defaultProps: {
            hidden: true,
          },
        },
      },
    },
    show: {
      fields: ["*", "!create_time"],
    },
  },
};
