import { addFlockRpaJob } from "@/workers/rpa/queue";
import type { FlockQuoteInput } from "@/workers/rpa/flock/types";

export type FlockQuoteJobData = {
  quoteId: string;
  requestId: string;
  customerId: string;
  cargoHash: string;
  input: FlockQuoteInput;
};

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