import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  // Unique build ID forces Cloudflare CDN to invalidate cached static chunks on each deploy
  generateBuildId: async () => `build-${Date.now()}`,
  async redirects() {
    return [
      { source: '/', destination: '/en/dashboard', permanent: false },
      { source: '/:lang(en|th)', destination: '/:lang/dashboard', permanent: false },
      { source: '/dashboard', destination: '/en/dashboard', permanent: false },
      { source: '/dashboard/:path*', destination: '/en/dashboard/:path*', permanent: false },
      { source: '/clients', destination: '/en/clients', permanent: false },
      { source: '/clients/:path*', destination: '/en/clients/:path*', permanent: false },
      { source: '/matters', destination: '/en/matters', permanent: false },
      { source: '/documents', destination: '/en/documents', permanent: false },
    ]
  },
}

export default nextConfig
