import { temporaryRoleService } from "@shared/modules/system/temp-role.service";
import { terminalService } from "./terminal.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)
        setInterval(() => {
            terminalService.update();
        }, 60 * 1000);

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