import { json } from "@remix-run/node";

export async function loader() {
  const manifest = {
    name: "ویترون - پلتفرم خرید آنلاین",
    short_name: "ویترون",
    description: "ویترون بهترین پلتفرم خرید آنلاین در ایران",
    start_url: "/",
    display: "standalone",
    display_override: ["window-controls-overlay"],
    background_color: "#ffffff",
    theme_color: "#023E8A",
    orientation: "portrait-primary",
    scope: "/",
    lang: "fa",
    dir: "rtl",
    categories: ["shopping", "business"],
    shortcuts: [
      {
        name: "ویترون",
        url: "/",
        icons: [
          { src: "/icon-512x512.png", sizes: "512x512", type: "image/png" },
        ],
      },
      {
        name: "جستجو",
        url: "/explore",
        icons: [
          { src: "/icon-192x192.png", sizes: "192x192", type: "image/png" },
        ],
      },
      {
        name: "سبد خرید",
        url: "/cart",
        icons: [
          { src: "/icon-192x192.png", sizes: "192x192", type: "image/png" },
        ],
      },
    ],
    protocol_handlers: [
      {
        protocol: "mailto",
        url: "/?mailto=%s",
      },
      {
        protocol: "web+vitrown",
        url: "/?action=%s",
      },
    ],
    icons: [
      {
        src: "/icon-48x48.png",
        sizes: "48x48",
        type: "image/png",
        purpose: "any",
      },
      {
        src: "/icon-72x72.png",
        sizes: "72x72",
        type: "image/png",
        purpose: "any",
      },
      {
        src: "/icon-96x96.png",
        sizes: "96x96",
        type: "image/png",
        purpose: "any",
      },
      {
        src: "/icon-144x144.png",
        sizes: "144x144",
        type: "image/png",
        purpose: "any",
      },
      {
        src: "/icon-192x192.png",
        sizes: "192x192",
        type: "image/png",
        purpose: "any",
      },
      {
        src: "/icon-512x512.png",
        sizes: "512x512",
        type: "image/png",
        purpose: "any",
      },
      {
        src: "/icon-192x192-maskable.png",
        sizes: "192x192",
        type: "image/png",
        purpose: "maskable",
      },
      {
        src: "/icon-512x512-maskable.png",
        sizes: "512x512",
        type: "image/png",
        purpose: "maskable",
      },
      {
        src: "/favicon.ico",
        sizes: "32x32",
        type: "image/x-icon",
      },
    ],
  };

  return json(manifest, {
    headers: {
      "Cache-Control": "public, max-age=600",
      "Content-Type": "application/manifest+json",
    },
  });
}
