const withPWA = require('next-pwa')({
  dest: 'public',
  register: true,
  skipWaiting: true,
  disable: process.env.NODE_ENV === 'development',
  runtimeCaching: [
    {
      urlPattern: /^https:\/\/.*\/api\/v1\/dashboard/,
      handler: 'NetworkFirst',
      options: { cacheName: 'api-dashboard', expiration: { maxAgeSeconds: 300 } },
    },
    {
      urlPattern: /^https:\/\/.*\/api\/v1\/clients/,
      handler: 'NetworkFirst',
      options: { cacheName: 'api-clients', expiration: { maxAgeSeconds: 60 } },
    },
  ],
});

/** @type {import('next').NextConfig} */
const config = {
  reactStrictMode: true,
  images: { domains: ['localhost'] },
};

module.exports = withPWA(config);
