import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  images: {
    // Configure remote patterns for external image sources (SharePoint, CDN, etc.)
    remotePatterns: [
      // SharePoint Online (Microsoft 365)
      {
        protocol: 'https',
        hostname: '**.sharepoint.com',
      },
      // SharePoint Server (on-premises) - update with your domain
      // Uncomment and update if using on-premises SharePoint:
      // {
      //   protocol: 'https',
      //   hostname: 'sharepoint.yourcompany.com',
      // },
      // Add other CDN or image hosting domains as needed
    ],
    // Configure local patterns for API routes with query strings
    localPatterns: [
      {
        pathname: '/api/photos/**/image',
      },
    ],
    // Enable image optimization in production
    // In development, images are unoptimized for faster iteration
    unoptimized: process.env.NODE_ENV === 'development',
  },
};

export default nextConfig;
