const apiManifest = {
  runtime: {
    baseUrl: "window.settings.base_url + /api/v2",
    securePathPrefix: "window.settings.secure_path",
    publicEndpoints: [
      "/passport/auth/login",
      "/passport/auth/token2Login",
      "/passport/auth/register",
      "/guest/comm/config",
      "/passport/comm/sendEmailVerify",
      "/passport/auth/forget",
    ],
    notes: [
      "All authenticated admin endpoints are prefixed with the secure path.",
      "Authorization header is injected automatically except for public endpoints.",
      "Content-Language header comes from localStorage.i18nextLng.",
    ],
  },
  modules: {
    stat: {
      getOrder: "GET {secure}/stat/getOrder",
      getStats: "GET {secure}/stat/getStats",
      getTrafficRank: "GET {secure}/stat/getTrafficRank",
    },
    theme: {
      getThemes: "GET {secure}/theme/getThemes",
      getThemeConfig: "POST {secure}/theme/getThemeConfig",
      saveThemeConfig: "POST {secure}/theme/saveThemeConfig",
      upload: "POST {secure}/theme/upload",
      remove: "POST {secure}/theme/delete",
    },
    serverManage: {
      getNodes: "GET {secure}/server/manage/getNodes",
      save: "POST {secure}/server/manage/save",
      drop: "POST {secure}/server/manage/drop",
      batchDelete: "POST {secure}/server/manage/batchDelete",
      copy: "POST {secure}/server/manage/copy",
      update: "POST {secure}/server/manage/update",
      sort: "POST {secure}/server/manage/sort",
      resetTraffic: "POST {secure}/server/manage/resetTraffic",
      batchResetTraffic: "POST {secure}/server/manage/batchResetTraffic",
    },
    serverGroup: {
      fetch: "GET {secure}/server/group/fetch",
      save: "POST {secure}/server/group/save",
      drop: "POST {secure}/server/group/drop",
    },
    serverRoute: {
      fetch: "GET {secure}/server/route/fetch",
      save: "POST {secure}/server/route/save",
      drop: "POST {secure}/server/route/drop",
    },
    payment: {
      fetch: "GET {secure}/payment/fetch",
      getPaymentMethods: "GET {secure}/payment/getPaymentMethods",
      getPaymentForm: "POST {secure}/payment/getPaymentForm",
      save: "POST {secure}/payment/save",
      drop: "POST {secure}/payment/drop",
      show: "POST {secure}/payment/show",
      sort: "POST {secure}/payment/sort",
    },
    notice: {
      fetch: "GET {secure}/notice/fetch",
      save: "POST {secure}/notice/save",
      drop: "POST {secure}/notice/drop",
      show: "POST {secure}/notice/show",
      sort: "POST {secure}/notice/sort",
    },
    knowledge: {
      fetch: "GET {secure}/knowledge/fetch",
      fetchById: "GET {secure}/knowledge/fetch?id={id}",
      save: "POST {secure}/knowledge/save",
      drop: "POST {secure}/knowledge/drop",
      show: "POST {secure}/knowledge/show",
      sort: "POST {secure}/knowledge/sort",
    },
    plan: {
      fetch: "GET {secure}/plan/fetch",
      save: "POST {secure}/plan/save",
      update: "POST {secure}/plan/update",
      drop: "POST {secure}/plan/drop",
      sort: "POST {secure}/plan/sort",
    },
    order: {
      fetch: "POST {secure}/order/fetch",
      detail: "POST {secure}/order/detail",
      paid: "POST {secure}/order/paid",
      cancel: "POST {secure}/order/cancel",
      update: "POST {secure}/order/update",
      assign: "POST {secure}/order/assign",
    },
    giftCard: {
      templates: "POST {secure}/gift-card/templates",
      createTemplate: "POST {secure}/gift-card/create-template",
      updateTemplate: "POST {secure}/gift-card/update-template",
      deleteTemplate: "POST {secure}/gift-card/delete-template",
      codes: "POST {secure}/gift-card/codes",
      generateCodes: "POST {secure}/gift-card/generate-codes",
      toggleCode: "POST {secure}/gift-card/toggle-code",
      usages: "POST {secure}/gift-card/usages",
      statistics: "POST {secure}/gift-card/statistics",
    },
    coupon: {
      fetch: "POST {secure}/coupon/fetch",
      generate: "POST {secure}/coupon/generate",
      drop: "POST {secure}/coupon/drop",
      update: "POST {secure}/coupon/update",
    },
    user: {
      fetch: "POST {secure}/user/fetch",
      update: "POST {secure}/user/update",
      resetSecret: "POST {secure}/user/resetSecret",
      generate: "POST {secure}/user/generate",
      getStatUser: "POST {secure}/stat/getStatUser",
      destroy: "POST {secure}/user/destroy",
      sendMail: "POST {secure}/user/sendMail",
      dumpCsv: "POST {secure}/user/dumpCSV",
      ban: "POST {secure}/user/ban",
    },
    trafficReset: {
      logs: "GET {secure}/traffic-reset/logs",
      resetUser: "POST {secure}/traffic-reset/reset-user",
      userHistory: "GET {secure}/traffic-reset/user/{id}/history",
    },
    ticket: {
      fetch: "POST {secure}/ticket/fetch",
      fetchById: "GET {secure}/ticket/fetch?id={id}",
      reply: "POST {secure}/ticket/reply",
      close: "POST {secure}/ticket/close",
    },
    config: {
      fetch: "GET {secure}/config/fetch?key={key}",
      save: "POST {secure}/config/save",
      getEmailTemplate: "GET {secure}/config/getEmailTemplate",
      testSendMail: "POST {secure}/config/testSendMail",
      setTelegramWebhook: "POST {secure}/config/setTelegramWebhook",
      systemStatus: "GET {secure}/system/getSystemStatus",
      queueStats: "GET {secure}/system/getQueueStats",
      queueWorkload: "GET {secure}/system/getQueueWorkload",
      queueMasters: "GET {secure}/system/getQueueMasters",
      horizonFailedJobs: "GET {secure}/system/getHorizonFailedJobs",
    },
  },
};

module.exports = {
  apiManifest,
};
