import { authRoutes } from "@/features/auth/routes.js";
import { agencyOpeningRoutes } from "@/features/agency-opening/routes.js";
import { achievementRoutes } from "@/features/achievements/routes.js";
import { activityTemplatesRoutes } from "@/features/activity-templates/routes.js";
import { appConfigRoutes } from "@/features/app-config/routes.js";
import { appUserRoutes } from "@/features/app-users/routes.js";
import { cumulativeRechargeRewardRoutes } from "@/features/cumulative-recharge-reward/routes.js";
import { cpConfigRoutes } from "@/features/cp-config/routes.js";
import { cpWeeklyRankRoutes } from "@/features/cp-weekly-rank/routes.js";
import { dashboardRoutes } from "@/features/dashboard/routes.js";
import { dailyTaskRoutes } from "@/features/daily-tasks/routes.js";
import { externalAdminUserRoutes } from "@/features/external-admin-users/routes.js";
import { firstRechargeRewardRoutes } from "@/features/first-recharge-reward/routes.js";
import { gameRoutes } from "@/features/games/routes.js";
import { hostAgencyPolicyRoutes } from "@/features/host-agency-policy/routes.js";
import { hostOrgRoutes } from "@/features/host-org/routes.js";
import { inviteActivityRewardRoutes } from "@/features/invite-activity-reward/routes.js";
import { levelConfigRoutes } from "@/features/level-config/routes.js";
import { logsRoutes } from "@/features/logs/routes.js";
import { luckyGiftRoutes } from "@/features/lucky-gift/routes.js";
import { menusRoutes } from "@/features/menus/routes.js";
import { operationsRoutes } from "@/features/operations/routes.js";
import { paymentRoutes } from "@/features/payment/routes.js";
import { policyConfigRoutes } from "@/features/policy-config/routes.js";
import { registrationRewardRoutes } from "@/features/registration-reward/routes.js";
import { redPacketRoutes } from "@/features/red-packets/routes.js";
import { regionBlockRoutes } from "@/features/region-blocks/routes.js";
import { resourceRoutes } from "@/features/resources/routes.js";
import { riskConfigRoutes } from "@/features/risk-config/routes.js";
import { rolesRoutes } from "@/features/roles/routes.js";
import { roomRoutes } from "@/features/rooms/routes.js";
import { roomRocketRoutes } from "@/features/room-rocket/routes.js";
import { roomTurnoverRewardRoutes } from "@/features/room-turnover-reward/routes.js";
import { sevenDayCheckInRoutes } from "@/features/seven-day-checkin/routes.js";
import { teamsRoutes } from "@/features/teams/routes.js";
import { userLeaderboardRoutes } from "@/features/user-leaderboard/routes.js";
import { usersRoutes } from "@/features/users/routes.js";
import { vipConfigRoutes } from "@/features/vip-config/routes.js";
import { weeklyStarRoutes } from "@/features/weekly-star/routes.js";
import type { MenuCode } from "@/app/permissions";
import type { AdminRoute, PublicRoute } from "./types";

export const publicRoutes: PublicRoute[] = authRoutes;

export const adminRoutes: AdminRoute[] = [
    ...dashboardRoutes,
    ...appUserRoutes,
    ...levelConfigRoutes,
    ...riskConfigRoutes,
    ...regionBlockRoutes,
    ...roomRoutes,
    ...appConfigRoutes,
    ...activityTemplatesRoutes,
    ...dailyTaskRoutes,
    ...achievementRoutes,
    ...registrationRewardRoutes,
    ...firstRechargeRewardRoutes,
    ...cumulativeRechargeRewardRoutes,
    ...inviteActivityRewardRoutes,
    ...sevenDayCheckInRoutes,
    ...roomRocketRoutes,
    ...roomTurnoverRewardRoutes,
    ...weeklyStarRoutes,
    ...agencyOpeningRoutes,
    ...userLeaderboardRoutes,
    ...redPacketRoutes,
    ...cpConfigRoutes,
    ...cpWeeklyRankRoutes,
    ...vipConfigRoutes,
    ...resourceRoutes,
    ...operationsRoutes,
    ...externalAdminUserRoutes,
    ...policyConfigRoutes,
    ...luckyGiftRoutes,
    ...paymentRoutes,
    ...gameRoutes,
    ...usersRoutes,
    ...hostAgencyPolicyRoutes,
    ...hostOrgRoutes,
    ...rolesRoutes,
    ...teamsRoutes,
    ...menusRoutes,
    ...logsRoutes,
];

export const defaultAdminPath = "/overview";

const routeByMenuCode = new Map<string, AdminRoute>(adminRoutes.map((route) => [route.menuCode, route]));

export function getRouteByMenuCode(menuCode: MenuCode | string) {
    return routeByMenuCode.get(menuCode);
}
