import type { CapacitorConfig } from '@capacitor/cli';
import { TEST_USER_ZERO_CONFIG } from './src/config/test-user-zero';

const config: CapacitorConfig = {
  appId: 'org.timesafari.dailynotification.test',
  appName: 'Daily Notification Test',
  webDir: 'dist',
  plugins: {
    Clipboard: {
      // Enable clipboard functionality
    },
    DailyNotification: {
      // Basic plugin configuration
      debugMode: true,
      enableNotifications: true,
      
      // TimeSafari integration for User Zero
      timesafariConfig: {
        activeDid: TEST_USER_ZERO_CONFIG.identity.did,
        endpoints: {
          // Use getApiServerUrl() to get correct URL based on serverMode
          projectsLastUpdated: `${TEST_USER_ZERO_CONFIG.getApiServerUrl()}${TEST_USER_ZERO_CONFIG.api.starsEndpoint}`
        },
        starredProjectsConfig: {
          enabled: true,
          starredPlanHandleIds: TEST_USER_ZERO_CONFIG.starredProjects.planIds,
          fetchInterval: '0 8 * * *' // Daily at 8 AM
        },
        credentialConfig: {
          jwtSecret: 'test-jwt-secret-for-user-zero-development-only',
          tokenExpirationMinutes: TEST_USER_ZERO_CONFIG.api.jwtExpirationMinutes
        }
      },
      
      // Network configuration
      networkConfig: {
        timeout: TEST_USER_ZERO_CONFIG.testing.timeoutMs,
        retryAttempts: TEST_USER_ZERO_CONFIG.testing.retryAttempts,
        retryDelay: TEST_USER_ZERO_CONFIG.testing.retryDelayMs
      },
      
      // Content fetch configuration (5 minutes before notification)
      contentFetch: {
        enabled: true,
        schedule: `0 ${TEST_USER_ZERO_CONFIG.notifications.scheduleTime.split(':')[1]} * * *`,
        fetchLeadTimeMinutes: TEST_USER_ZERO_CONFIG.notifications.fetchLeadTimeMinutes,
        callbacks: {
          onSuccess: 'handleStarsQuerySuccess',
          onError: 'handleStarsQueryError'
        }
      }
    }
  }
};

export default config;
