import { vi } from 'vitest';
import { AIProvider } from '../src/providers/anthropic';

// Mock fs module
export const mockFs = {
  readFileSync: vi.fn(),
  writeFileSync: vi.fn(),
  existsSync: vi.fn(),
  unlinkSync: vi.fn(),
};

// Mock os module
export const mockOs = {
  homedir: vi.fn().mockReturnValue('/mock/home'),
};

// Mock child_process module
export const mockChildProcess = {
  execSync: vi.fn(),
};

// Mock AI provider for testing
export class MockAIProvider implements AIProvider {
  constructor(private mockResponse: string = 'mock response') {}

  async sendPrompt(): Promise<string> {
    return this.mockResponse;
  }
}

// Helper to create temp files for testing
export function createTempMarkdown(content: string): string {
  const tempPath = `.temp-${Date.now()}.md`;
  mockFs.writeFileSync(tempPath, content, 'utf-8');
  return tempPath;
}

// Setup function to reset all mocks
export function setupMocks() {
  vi.mock('fs', () => mockFs);
  vi.mock('os', () => mockOs);
  vi.mock('child_process', () => mockChildProcess);
} 