import type { ParkedSessionJobData } from "@/modules/address/parked-session-queue-types";
import {
  preheatParkedQuoteSession,
  releaseParkedQuoteSession,
} from "@/workers/rpa/parked-quote-session";
import { withRpaSessionLock } from "@/workers/rpa/session-manager";

export async function processParkedSessionPreheatJob(
  data: ParkedSessionJobData,
): Promise<void> {
  await withRpaSessionLock(async () => {
    await preheatParkedQuoteSession(data.sessionId);
  });
}

export async function processReleaseParkedSessionJob(
  data: ParkedSessionJobData,
): Promise<void> {
  await withRpaSessionLock(async () => {
    await releaseParkedQuoteSession(data.sessionId);
  });
}
