import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  reactCompiler: true,
  trailingSlash: true,

  images: {
    // 680 covers ~380px CSS slots on 1.75x DPR phones (Lighthouse mobile), which otherwise jump to 750
    deviceSizes: [640, 680, 750, 828, 1080, 1200, 1920, 2048, 3840],
    
  
    // Server runs in DigitalOcean blr1, where the Spaces hostname resolves to a private VPC IP.
    // Safe here because remotePatterns limits the optimizer to that single bucket path.
    dangerouslyAllowLocalIP: true,
    remotePatterns: [
      new URL("https://clonifynow-live.blr1.digitaloceanspaces.com/clonifynow/**"),
    ],
  },
  async redirects() {
    return [
      // Old indexed URLs -> updated pages
      { source: "/fintech", destination: "/fintech-app-development/", permanent: true },
      { source: "/ai-agent", destination: "/ai-agent-development-service/", permanent: true },
      { source: "/ai-agent-development", destination: "/ai-agent-development-service/", permanent: true },
      { source: "/ai-development", destination: "/ai-services-solutions/", permanent: true },
      { source: "/ai-development-service", destination: "/ai-services-solutions/", permanent: true },
      { source: "/fourzerofour", destination: "/", permanent: true },
      { source: "/impact-of-ai-agents-workflow-automation", destination: "/blog/impact-of-ai-agents-workflow-automation/", permanent: true },
      { source: "/boost-apps-performance-with-proven-techniques", destination: "/blog/boost-apps-performance-with-proven-techniques/", permanent: true },
      { source: "/choosing-the-right-ai-agent-development-service-a-guide-for-business-owners", destination: "/blog/choosing-the-right-ai-agent-development-service-a-guide-for-business-owners/", permanent: true },
      { source: "/ecommerce-marketplace-development",destination: "/marketplace-development/", permanent: true },
      { source: "/artificial-intelligence-development", destination: "/ai-services-solutions/", permanent: true },

      { source: "/sitemap_index.xml", destination: "/sitemap.xml", permanent: true },

      // Moved to external domains
      { source: "/digital-marketing", destination: "https://bumppd.com/", permanent: true },
      { source: "/doordash-clone", destination: "https://clonifynow.com/doordash-clone/", permanent: true },
      { source: "/uber-clone", destination: "https://clonifynow.com/uber-clone/", permanent: true },
      { source: "/airbnb-clone", destination: "https://clonifynow.com/airbnb-clone/", permanent: true },
      { source: "/talabat-clone", destination: "https://clonifynow.com/talabat-clone/", permanent: true },
      { source: "/taskrabbit-clone", destination: "https://clonifynow.com/task-rabbit/", permanent: true },
      { source: "/insurance-software-development", destination: "https://clonifynow.com/ready-broker-app/", permanent: true },
    ];
  },
};

export default nextConfig;
