import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
import {
  CUSTOMERS_DEALS_BULK_UPDATE_OWNER_QUEUE,
  bulkUpdateDealOwnerWithProgress
} from "../lib/bulkDeals.js";
const metadata = {
  queue: CUSTOMERS_DEALS_BULK_UPDATE_OWNER_QUEUE,
  id: "customers:deals-bulk-update-owner",
  concurrency: 1
};
async function handle(job, _ctx) {
  const container = await createRequestContainer();
  try {
    await bulkUpdateDealOwnerWithProgress({
      container,
      progressJobId: job.payload.progressJobId,
      ids: job.payload.ids,
      ownerUserId: job.payload.ownerUserId,
      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 owner 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-owner.js.map
