/**
 * Utility for creating typed job handlers
 */

import type { JobHandler, TypedJobHandler } from '@stock-bot/types';

/**
 * Create a typed job handler with validation
 */
export function createJobHandler<TPayload = unknown, TResult = unknown>(
  handler: TypedJobHandler<TPayload, TResult>
): JobHandler<unknown, TResult> {
  return async (payload: unknown): Promise<TResult> => {
    return handler(payload as TPayload);
  };
}
