import type { CapacitorConfig } from "@capacitor/cli";

/**
 * Capacitor native-shell config for Koja (کجا).
 *
 * Strategy: the app is an SSR/ISR Next.js site, so we do NOT bundle a static
 * export. Instead the native WebView loads the live hosted PWA via `server.url`.
 * Content updates ship instantly (no store re-publish); only native changes
 * (push SDK, splash, permissions) require a new APK/AAB.
 *
 * Stores: Cafe Bazaar + Myket + direct APK. (No Google Play / FCM — Iran.)
 * Push: Pushe (cordova-plugin-pushe), consumed through Capacitor.
 */
const config: CapacitorConfig = {
  appId: "ir.meezi.koja",
  appName: "کجا",
  // `webDir` is required by the CLI but unused when `server.url` is set.
  webDir: "public",
  server: {
    // Production PWA the WebView loads. Override per-build with CAP_SERVER_URL.
    url: process.env.CAP_SERVER_URL ?? "https://koja.meezi.ir",
    cleartext: false,
    androidScheme: "https",
  },
  android: {
    allowMixedContent: false,
    backgroundColor: "#f9fafb",
  },
  plugins: {
    SplashScreen: {
      launchShowDuration: 1200,
      backgroundColor: "#0F6E56",
      androidScaleType: "CENTER_CROP",
      showSpinner: false,
    },
  },
};

export default config;
