import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  devIndicators: false,
  experimental: {
    // `next build` runs page generation across several parallel workers,
    // each firing its own concurrent fetches — that burst hits the same
    // shared-hosting Laravel backend (40-process cap) that revalidate-based
    // caching in lib/api/server.ts is trying to protect, and was enough to
    // trip transient 503s mid-build even with per-fetch retries. Forcing a
    // single worker (minPagesPerWorker higher than the page count) and
    // processing one page at a time keeps build-time load in line with what
    // the backend can actually take; retryCount re-runs a page's whole
    // render (not just one fetch) if a 503 still slips through.
    staticGenerationRetryCount: 2,

  },
  async headers() {
    return [
      {
        source: "/:path*",
        headers: [
          // Basic hardening headers only — a real Content-Security-Policy
          // needs the actual script/style/image sources enumerated first
          // (inline styles, Midtrans CDN, etc.) or it'll break the app, so
          // that's deliberately left for a separate pass.
          { key: "X-Frame-Options", value: "DENY" },
          { key: "X-Content-Type-Options", value: "nosniff" },
          { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
          { key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains" },
        ],
      },
    ];
  },
};

export default nextConfig;
