import type { AppConfig } from "@wrnexus/styles";

const config = {
  seo: {
    title: "WRNexus i18n Showcase",
    description: "English, Hindi, and Marathi internationalization examples.",
    robots: "noindex,nofollow",
  },
  theme: { palette: "violet", default: "light" },
  fonts: {
    google: [
      { family: "Plus Jakarta Sans", weights: [400, 500, 600, 700] },
      { family: "Noto Sans Devanagari", weights: [400, 500, 600, 700] },
    ],
    display: "swap",
    sans: '"Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif',
  },
  // Keep localhost development deterministic. A service-worker navigation cache
  // is URL-based and cannot distinguish pages rendered from different cookies.
  pwa: { serviceWorker: false },
  i18n: {
    default: "en",
    locales: ["en", "hi", "mr"],
    labels: { en: "English", hi: "हिन्दी", mr: "मराठी" },
    fallbacks: { hi: ["en"], mr: ["en"] },
    cookie: { name: "wire-lang", path: "/", maxAge: 31_536_000, sameSite: "Lax" },
    strict: true,
  },
  styles: {
    entry: "app/styles/global.css",
    failureMode: "throw",
    process: async ({ entryPath, appRoot, mode }) => {
      if (!entryPath) throw new Error("The i18n showcase stylesheet was not resolved.");
      const args = ["@tailwindcss/cli", "-i", entryPath];
      if (mode === "production") args.push("--minify");
      return await Bun.$.cwd(appRoot)`bunx ${args}`.text();
    },
  },
} satisfies AppConfig;

export default config;
