// src/tests/utils/mockLogger.ts
import { vi } from 'vitest';
import type { Logger } from 'pino';

/**
 * Creates a complete, type-safe mock of the Pino logger for use in tests.
 * All logger methods are replaced with `vi.fn()`.
 * The `child` method is mocked to return itself, allowing for chained calls
 * like `logger.child({ ... }).info(...)` to work seamlessly in tests.
 */
// prettier-ignore
export const createMockLogger = (): Logger => ({
  info: vi.fn(),
  debug: vi.fn(),
  error: vi.fn(),
  warn: vi.fn(),
  fatal: vi.fn(),
  trace: vi.fn(),
  silent: vi.fn(),
  child: vi.fn().mockReturnThis(),
} as unknown as Logger);

export const mockLogger = createMockLogger();