import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
import {
  CUSTOMERS_DEALS_BULK_UPDATE_STAGE_QUEUE,
  bulkUpdateDealStageWithProgress
} from "../lib/bulkDeals.js";
const metadata = {
  queue: CUSTOMERS_DEALS_BULK_UPDATE_STAGE_QUEUE,
  id: "customers:deals-bulk-update-stage",
  concurrency: 1
};
async function handle(job, _ctx) {
  const container = await createRequestContainer();
  try {
    await bulkUpdateDealStageWithProgress({
      container,
      progressJobId: job.payload.progressJobId,
      ids: job.payload.ids,
      pipelineStageId: job.payload.pipelineStageId,
      scope: job.payload.scope
    });
  } catch (error) {
    const progressService = container.resolve("progressService");
    await progressService.failJob(
      job.payload.progressJobId,
      {
        errorMessage: error instanceof Error ? error.message : "Bulk deal stage update failed"
      },
      {
        tenantId: job.payload.scope.tenantId,
        organizationId: job.payload.scope.organizationId,
        userId: job.payload.scope.userId
      }
    );
    throw error;
  }
}
export {
  handle as default,
  metadata
};
//# sourceMappingURL=deals-bulk-update-stage.js.map
