/**
 * Code generators index
 */

export * from './types';
export { GeneratorRegistry, globalRegistry } from './generator-registry';
export { FileWriter } from './file-writer';
export { CodeGenerator } from './code-generator';
export type { CodeGenerationOptions, CodeGenerationResult } from './code-generator';
export type { WriteOptions, WriteResult } from './file-writer';

// Export built-in generators
export { MarkdownDocumentationGenerator } from './docs/markdown-generator';
export { ReactGenerator } from './frontend/react-generator';
export { TypeScriptExpressGenerator } from './backend/typescript-express-generator';
export { TypeScriptCliGenerator } from './cli/typescript-cli-generator';
export { PrismaGenerator } from './database/prisma-generator';
export { DrizzleGenerator } from './database/drizzle-generator';
export { FrontendTestGenerator } from './test/frontend-test-generator';
export { BackendTestGenerator } from './test/backend-test-generator';
export { E2ETestGenerator } from './test/e2e-test-generator';
export { CliTestGenerator } from './test/cli-test-generator';
export { EnhancedTestingGenerator } from './test/enhanced-testing-generator';
export { EnhancedMonitoringGenerator } from './monitoring/enhanced-monitoring-generator';
export { EnhancedSecurityGenerator } from './security/enhanced-security-generator';
export { EnhancedPerformanceGenerator } from './performance/enhanced-performance-generator';
export { EnhancedI18nGenerator } from './i18n/enhanced-i18n-generator';
export { EnhancedFeatureFlagsGenerator } from './feature-flags/enhanced-feature-flags-generator';
export { EnhancedAccessControlGenerator } from './access-control/enhanced-access-control-generator';
export { EnhancedApiGenerator } from './api/enhanced-api-generator';
export { EnhancedDeploymentGenerator } from './deployment/enhanced-deployment-generator';
export { EnhancedAnalyticsGenerator } from './analytics/enhanced-analytics-generator';
export { EnhancedMigrationsGenerator } from './database/enhanced-migrations-generator';
export { EnhancedErrorHandlingGenerator } from './error/enhanced-error-handling-generator';
export { EnhancedRateLimitingGenerator } from './rate-limiting/enhanced-rate-limiting-generator';
export { EnhancedEmailGenerator } from './email/enhanced-email-generator';
export { EnhancedBackgroundJobsGenerator } from './jobs/enhanced-background-jobs-generator';
export { DockerComposeGenerator } from './docker/docker-compose-generator';
export { GitHubActionsGenerator } from './ci-cd/github-actions-generator';
export { EnvironmentGenerator } from './env/environment-generator';
export { ServiceGenerator } from './infrastructure/service-generator';
export { UpstashRedisGenerator } from './cache/upstash-redis-generator';
export { generateEventTypes } from './events/event-types-generator';
export { generateEventBus } from './events/event-bus-generator';
export { generateEventHandlers } from './events/event-handlers-generator';
export { generateWebSocketServer } from './websocket/websocket-server-generator';
export { generateWebSocketClient } from './websocket/websocket-client-generator';

// Initialize built-in generators
import { globalRegistry } from './generator-registry';
import { MarkdownDocumentationGenerator } from './docs/markdown-generator';
import { ReactGenerator } from './frontend/react-generator';
import { TypeScriptExpressGenerator } from './backend/typescript-express-generator';
import { TypeScriptCliGenerator } from './cli/typescript-cli-generator';
import { PrismaGenerator } from './database/prisma-generator';
import { DrizzleGenerator } from './database/drizzle-generator';
import { FrontendTestGenerator } from './test/frontend-test-generator';
import { BackendTestGenerator } from './test/backend-test-generator';
import { E2ETestGenerator } from './test/e2e-test-generator';
import { CliTestGenerator } from './test/cli-test-generator';
import { EnhancedTestingGenerator } from './test/enhanced-testing-generator';
import { EnhancedMonitoringGenerator } from './monitoring/enhanced-monitoring-generator';
import { EnhancedSecurityGenerator } from './security/enhanced-security-generator';
import { EnhancedPerformanceGenerator } from './performance/enhanced-performance-generator';
import { EnhancedI18nGenerator } from './i18n/enhanced-i18n-generator';
import { EnhancedFeatureFlagsGenerator } from './feature-flags/enhanced-feature-flags-generator';
import { EnhancedAccessControlGenerator } from './access-control/enhanced-access-control-generator';
import { EnhancedApiGenerator } from './api/enhanced-api-generator';
import { EnhancedDeploymentGenerator } from './deployment/enhanced-deployment-generator';
import { EnhancedAnalyticsGenerator } from './analytics/enhanced-analytics-generator';
import { EnhancedMigrationsGenerator } from './database/enhanced-migrations-generator';
import { EnhancedErrorHandlingGenerator } from './error/enhanced-error-handling-generator';
import { EnhancedRateLimitingGenerator } from './rate-limiting/enhanced-rate-limiting-generator';
import { EnhancedEmailGenerator } from './email/enhanced-email-generator';
import { EnhancedBackgroundJobsGenerator } from './jobs/enhanced-background-jobs-generator';
import { GitHubActionsGenerator } from './ci-cd/github-actions-generator';
import { EnvironmentGenerator } from './env/environment-generator';
import { ServiceGenerator } from './infrastructure/service-generator';
import { UpstashRedisGenerator } from './cache/upstash-redis-generator';
import { generateEventTypes } from './events/event-types-generator';
import { generateEventBus } from './events/event-bus-generator';
import { generateEventHandlers } from './events/event-handlers-generator';
import { generateWebSocketServer } from './websocket/websocket-server-generator';
import { generateWebSocketClient } from './websocket/websocket-client-generator';

// Register built-in generators with the global registry
const markdownGenerator = new MarkdownDocumentationGenerator();
globalRegistry.registerDocumentationGenerator(markdownGenerator);

const reactGenerator = new ReactGenerator();
globalRegistry.registerFrontendGenerator(reactGenerator);

const typescriptExpressGenerator = new TypeScriptExpressGenerator();
globalRegistry.registerBackendGenerator(typescriptExpressGenerator);

const typescriptCliGenerator = new TypeScriptCliGenerator();
globalRegistry.registerCliGenerator(typescriptCliGenerator);

const prismaGenerator = new PrismaGenerator();
globalRegistry.registerDatabaseGenerator(prismaGenerator);

const drizzleGenerator = new DrizzleGenerator();
globalRegistry.registerDatabaseGenerator(drizzleGenerator);

const frontendTestGenerator = new FrontendTestGenerator();
globalRegistry.registerTestGenerator(frontendTestGenerator);

const backendTestGenerator = new BackendTestGenerator();
globalRegistry.registerTestGenerator(backendTestGenerator);

const e2eTestGenerator = new E2ETestGenerator();
globalRegistry.registerTestGenerator(e2eTestGenerator);

const cliTestGenerator = new CliTestGenerator();
globalRegistry.registerTestGenerator(cliTestGenerator);

const enhancedTestingGenerator = new EnhancedTestingGenerator();
globalRegistry.registerCustomGenerator(enhancedTestingGenerator);

const enhancedMonitoringGenerator = new EnhancedMonitoringGenerator();
globalRegistry.registerCustomGenerator(enhancedMonitoringGenerator);

const enhancedSecurityGenerator = new EnhancedSecurityGenerator();
globalRegistry.registerCustomGenerator(enhancedSecurityGenerator);

const enhancedPerformanceGenerator = new EnhancedPerformanceGenerator();
globalRegistry.registerCustomGenerator(enhancedPerformanceGenerator);

const enhancedI18nGenerator = new EnhancedI18nGenerator();
globalRegistry.registerCustomGenerator(enhancedI18nGenerator);

const enhancedFeatureFlagsGenerator = new EnhancedFeatureFlagsGenerator();
globalRegistry.registerCustomGenerator(enhancedFeatureFlagsGenerator);

const enhancedAccessControlGenerator = new EnhancedAccessControlGenerator();
globalRegistry.registerCustomGenerator(enhancedAccessControlGenerator);

const enhancedApiGenerator = new EnhancedApiGenerator();
globalRegistry.registerCustomGenerator(enhancedApiGenerator);

const enhancedDeploymentGenerator = new EnhancedDeploymentGenerator();
globalRegistry.registerCustomGenerator(enhancedDeploymentGenerator);

const enhancedAnalyticsGenerator = new EnhancedAnalyticsGenerator();
globalRegistry.registerCustomGenerator(enhancedAnalyticsGenerator);

const enhancedMigrationsGenerator = new EnhancedMigrationsGenerator();
globalRegistry.registerCustomGenerator(enhancedMigrationsGenerator);

const enhancedErrorHandlingGenerator = new EnhancedErrorHandlingGenerator();
globalRegistry.registerCustomGenerator(enhancedErrorHandlingGenerator);

const enhancedRateLimitingGenerator = new EnhancedRateLimitingGenerator();
globalRegistry.registerCustomGenerator(enhancedRateLimitingGenerator);

const enhancedEmailGenerator = new EnhancedEmailGenerator();
globalRegistry.registerCustomGenerator(enhancedEmailGenerator);

const enhancedBackgroundJobsGenerator = new EnhancedBackgroundJobsGenerator();
globalRegistry.registerCustomGenerator(enhancedBackgroundJobsGenerator);

const githubActionsGenerator = new GitHubActionsGenerator();
globalRegistry.registerCustomGenerator(githubActionsGenerator);

const environmentGenerator = new EnvironmentGenerator();
globalRegistry.registerCustomGenerator(environmentGenerator);

const serviceGenerator = new ServiceGenerator();
globalRegistry.registerCustomGenerator(serviceGenerator);

const upstashRedisGenerator = new UpstashRedisGenerator();
globalRegistry.registerCustomGenerator(upstashRedisGenerator);

// Register event-driven architecture generators
globalRegistry.registerCustomGenerator({
  id: 'event-types',
  name: 'Event Types Generator',
  description: 'Generates TypeScript event type interfaces from YAML event definitions',
  generate: generateEventTypes,
});

globalRegistry.registerCustomGenerator({
  id: 'event-bus',
  name: 'Event Bus Generator',
  description: 'Generates Redis pub/sub event bus infrastructure for event-driven architecture',
  generate: generateEventBus,
});

globalRegistry.registerCustomGenerator({
  id: 'event-handlers',
  name: 'Event Handlers Generator',
  description: 'Generates event handler implementations for consuming services',
  generate: generateEventHandlers,
});

globalRegistry.registerCustomGenerator({
  id: 'websocket-server',
  name: 'WebSocket Server Generator',
  description: 'Generates WebSocket server infrastructure for real-time updates',
  generate: generateWebSocketServer,
});

globalRegistry.registerCustomGenerator({
  id: 'websocket-client',
  name: 'WebSocket Client Generator',
  description: 'Generates React hooks and utilities for WebSocket connections',
  generate: generateWebSocketClient,
});
