// src/config/bullmq.ts
import { Queue, Worker, QueueOptions, WorkerOptions, Processor } from 'bullmq';
import redis from '@/shared/config/redis.js';

export const createQueue = (name: string, options?: QueueOptions) =>
  new Queue(name, {
    connection: redis,
    ...options,
  });

export const createWorker = (
  name: string,
  processor: Processor<unknown, unknown, string>,
  options?: Omit<WorkerOptions, 'connection'>,
) =>
  new Worker(name, processor, {
    connection: redis,
    ...options,
  });

// export const createScheduler = (name: string) => {
//   return new QueueScheduler(name, { connection: redis });
// };
