import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  async redirects() {
    return [
      {
        source: "/blog/teacher-training/a-complete-guide-to-tesol-in-india-2024-costs-courses-career-paths",
        destination: "/blog/teacher-training/tesol-certification-in-india-complete-guide-2026-costs-courses-and-careers",
        permanent: true,
      },
      {
        source: "/blog/ielts/how-can-i-become-ielts-certified-trainer",
        destination: "/blog/ielts/how-can-i-become-an-ielts-certified-trainer",
        permanent: true,
      },
      {
        source: "/algebra-one",
        destination: "/online-algebra-1-tutoring",
        permanent: true,
      },
    ];
  },
  deploymentId: process.env.NEXT_DEPLOYMENT_ID || process.env.DEPLOYMENT_VERSION,
  // The speech routes execute this Python analyzer at runtime. Because the
  // path is resolved dynamically, Next.js cannot discover it automatically
  // while producing the server trace for a production deployment.
  outputFileTracingIncludes: {
    "/api/speech/*": [
      "./scripts/speech_pitch_analysis.py",
      "./scripts/requirements-speech.txt",
    ],
  },
  webpack(config, { dev }) {
    if (dev && config.cache && typeof config.cache === "object") {
      config.cache = {
        ...config.cache,
        compression: false,
      };
    }

    return config;
  },
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "img.youtube.com",
      },
    ],
  },
  turbopack: {
    root: process.cwd(),
  },
  typescript: {
    ignoreBuildErrors: true,
  },
};

export default nextConfig;
