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

// URL de la PWA hosteada. La app es un shell: todo el contenido (PHP) se sirve
// desde aquí, por lo que actualizar el servidor actualiza la app sin republicar.
// Para probar contra XAMPP local, reemplaza por http://TU_IP_LAN/opce_supervisores
// y pon androidScheme: 'http' + cleartext: true.
const SERVER_URL = 'https://servidor.singularsoft.cl/opce_supervisores';

const config: CapacitorConfig = {
  appId: 'cl.singularsoft.opce.supervisores',
  appName: 'OPCE Supervisores',
  webDir: 'www',
  server: {
    url: SERVER_URL,
    androidScheme: 'https',
    // Dominios que siguen dentro del webview en lugar de abrir el navegador.
    allowNavigation: ['servidor.singularsoft.cl'],
    // Página local que se muestra si el servidor no responde (sin conexión).
    errorPath: 'error.html',
  },
  android: {
    // La PWA ya maneja su propio scroll; evita el rebote doble del webview.
    allowMixedContent: false,
    captureInput: true,
  },
  plugins: {
    SplashScreen: {
      launchShowDuration: 1500,
      backgroundColor: '#18181b',
      androidScaleType: 'CENTER_CROP',
      showSpinner: false,
      splashFullScreen: true,
      splashImmersive: false,
    },
  },
};

export default config;
