import { mock } from "bun:test";
import type { Logger } from "pino";

/**
 * Returns a minimal pino Logger stub suitable for dependency injection in tests.
 * All methods are bun:test mocks — they act as no-ops but can be asserted on:
 *
 *   const logger = mockLogger();
 *   // ... run code under test ...
 *   expect(logger.child as ReturnType<typeof mock>).toHaveBeenCalledWith({ module: "foo" });
 */
export function mockLogger(): Logger {
  const logger = {
    info: mock(() => {}),
    debug: mock(() => {}),
    warn: mock(() => {}),
    error: mock(() => {}),
    child: mock(function () {
      return logger;
    }),
  } as unknown as Logger;
  return logger;
}
