import { temporaryRoleService } from "./temp-role.service";

export const schedulerService = {
    start: () => {
        console.log("🕒 Scheduler started: Maintenance loops initialized.");

        // 1. Temporary Role Revocation (every 60s)
        setInterval(() => {
            temporaryRoleService.processExpiredRoles();
        }, 60 * 1000);

        // 2. Terminal Update Loop (every 60s)
        const { terminalService } = require("@/modules/terminal/terminal.service");
        setInterval(() => {
            terminalService.update();
        }, 60 * 1000);

        // Run an initial check on start
        temporaryRoleService.processExpiredRoles();
    }
};
