/**
 * Production Environment Configuration
 * CRITICAL: Read-only testing on production - no data modifications allowed
 */

module.exports = {
    // Environment identification
    name: 'production',
    displayName: 'Production Environment (READ-ONLY)',
    
    // Base URL and endpoints
    baseUrl: 'https://upskill.measurequick.com',
    adminUrl: 'https://upskill.measurequick.com/wp-admin',
    apiUrl: 'https://upskill.measurequick.com/wp-json',
    
    // Authentication endpoints
    loginPath: '/community-login/',
    logoutPath: '/wp-login.php?action=logout',
    
    // Browser configuration - more conservative for production
    browser: {
        type: 'chromium',
        headless: true, // Always headless in production
        slowMo: 1000, // Slower for production
        timeout: 45000, // Longer timeout for production
        viewport: { width: 1280, height: 720 },
        video: false, // No video recording in production
        screenshot: 'only-on-failure'
    },
    
    // Test execution settings - very conservative
    test: {
        timeout: 90000, // Longer timeout for production
        retries: 1, // Fewer retries to avoid spam
        workers: 1, // Single worker only
        parallel: false, // No parallel execution
        screenshotOnFailure: true,
        videoOnFailure: false
    },
    
    // WordPress specific settings
    wordpress: {
        adminUser: {
            // Production admin credentials from environment variables only
            username: process.env.PROD_WP_ADMIN_USERNAME,
            password: process.env.PROD_WP_ADMIN_PASSWORD
        },
        database: {
            // Read-only database access if needed
            host: process.env.PROD_DB_HOST,
            name: process.env.PROD_DB_NAME,
            user: process.env.PROD_DB_READ_USER,
            password: process.env.PROD_DB_READ_PASSWORD
        }
    },
    
    // Test accounts - production accounts only
    accounts: {
        masterTrainer: {
            username: process.env.PROD_MASTER_USERNAME,
            password: process.env.PROD_MASTER_PASSWORD,
            email: process.env.PROD_MASTER_EMAIL,
            role: 'master_trainer'
        },
        trainer: {
            username: process.env.PROD_TRAINER_USERNAME,
            password: process.env.PROD_TRAINER_PASSWORD,
            email: process.env.PROD_TRAINER_EMAIL,
            role: 'hvac_trainer'
        }
    },
    
    // Security settings - strict for production
    security: {
        allowInsecureCertificates: false,
        ignoreHttpsErrors: false,
        skipCsrfValidation: false
    },
    
    // Performance settings - minimal impact
    performance: {
        slowNetworkSimulation: false,
        resourceBlocking: {
            images: false,
            fonts: false,
            stylesheets: false
        }
    },
    
    // Evidence collection - minimal for production
    evidence: {
        screenshots: {
            enabled: true,
            onFailure: true,
            onSuccess: false,
            fullPage: false // Faster screenshots
        },
        videos: {
            enabled: false, // No videos in production
            onFailure: false,
            onSuccess: false
        },
        logs: {
            enabled: true,
            level: 'warn', // Only warnings and errors
            includeNetwork: false,
            includeConsole: false
        }
    },
    
    // Test data - READ-ONLY mode
    testData: {
        events: {
            // Use existing production data only
            readOnly: true,
            createTestData: false,
            modifyData: false
        },
        announcements: {
            readOnly: true,
            createTestData: false,
            modifyData: false
        }
    },
    
    // Protected URLs - production URLs
    protectedUrls: [
        '/trainer/dashboard/',
        '/trainer/venue/list/',
        '/trainer/venue/manage/', 
        '/trainer/organizer/manage/',
        '/trainer/profile/training-leads/',
        '/master-trainer/master-dashboard/',
        '/master-trainer/events/',
        '/master-trainer/google-sheets/',
        '/master-trainer/announcements/',
        '/master-trainer/pending-approvals/',
        '/master-trainer/trainers/',
        '/master-trainer/communication-templates/'
    ],
    
    // Expected response codes
    expectedResponseCodes: {
        authenticated: 200,
        unauthenticated: 302,
        forbidden: 403,
        notFound: 404
    },
    
    // Cleanup settings - NO CLEANUP in production
    cleanup: {
        deleteTestData: false,
        resetUserSessions: false,
        clearCache: false
    },
    
    // Production-specific warnings and validations
    productionSafeguards: {
        requireEnvironmentVariables: true,
        confirmReadOnlyMode: true,
        maxTestDuration: 300000, // 5 minutes max
        allowedTestTypes: ['smoke', 'read-only', 'monitoring'],
        forbiddenOperations: [
            'create',
            'update',
            'delete',
            'modify',
            'seed',
            'cleanup',
            'database-write'
        ]
    },
    
    // Monitoring and alerting
    monitoring: {
        enabled: true,
        alertOnFailures: true,
        alertThreshold: 1, // Alert on any failure
        healthCheckInterval: 300000, // 5 minutes
        endpoints: [
            '/',
            '/community-login/',
            '/trainer/dashboard/',
            '/master-trainer/master-dashboard/'
        ]
    }
};