import { addPriority1RpaJob } from "@/workers/rpa/queue";
import type { Priority1DemoInput } from "@/workers/rpa/priority1/demo-input";

export type Priority1QuoteJobData = {
  quoteId: string;
  requestId: string;
  customerId: string;
  cargoHash: string;
  input: Priority1DemoInput;
};

export async function enqueuePriority1QuoteJob(
  data: Priority1QuoteJobData,
): Promise<void> {
  if (process.env.RPA_QUEUE_ENABLED === "false") {
    console.log(
      `[priority1-queue] 队列已禁用 quote_id=${data.quoteId}`,
    );
    return;
  }
  await addPriority1RpaJob(data);
  console.log(`[priority1-queue] 已入队 quote_id=${data.quoteId}`);
}
