import { addParkedSessionJob } from "@/workers/rpa/queue";

/** 用户打开确认弹窗时异步预热驻留 RPA 页 */
export async function requestParkedSessionPreheat(
  sessionId: string,
): Promise<void> {
  if (process.env.RPA_QUEUE_ENABLED === "false") {
    return;
  }
  await addParkedSessionJob("parked-session-preheat", sessionId);
}

/** 用户取消地址确认时释放驻留页 */
export async function requestReleaseParkedSession(
  sessionId: string,
): Promise<void> {
  if (process.env.RPA_QUEUE_ENABLED === "false") {
    return;
  }
  await addParkedSessionJob("release-parked-session", sessionId);
}
