import { config as dotenvConfig } from "dotenv";
import { resolve } from "path";

// Load environment variables
dotenvConfig({ path: resolve(process.cwd(), ".env") });

export const config = {
  // Redis configuration
  redis: {
    host: process.env.REDIS_HOST || "localhost",
    port: parseInt(process.env.REDIS_PORT || "6379", 10),
    password: process.env.REDIS_PASSWORD,
    db: parseInt(process.env.REDIS_DB || "0", 10),
  },

  // Worker configuration
  worker: {
    concurrency: parseInt(process.env.WORKER_CONCURRENCY || "5", 10),
    maxJobsPerWorker: parseInt(process.env.MAX_JOBS_PER_WORKER || "100", 10),
  },

  // Service configuration
  serviceName: "wcag-ada-worker",

  // Scanner configuration
  scanner: {
    timeout: parseInt(process.env.SCANNER_TIMEOUT || "300000", 10), // 5 minutes
    maxRetries: parseInt(process.env.SCANNER_MAX_RETRIES || "3", 10),
  },

  // Database URL (for Prisma)
  databaseUrl: process.env.DATABASE_URL,

  // Environment
  env: process.env.NODE_ENV || "development",
  isDevelopment: process.env.NODE_ENV \!== "production",
  isProduction: process.env.NODE_ENV === "production",
};
