<?php
// Application Constants
if (!defined('APP_NAME')) {
    define('APP_NAME', 'Avondex Capital');
}
if (!defined('APP_VERSION')) {
    define('APP_VERSION', '1.0.0');
}
if (!defined('APP_URL')) {
    define('APP_URL', 'https://avondcapital.org');
}
if (!defined('APP_TIMEZONE')) {
    define('APP_TIMEZONE', 'UTC');
}

// Site Information
if (!defined('SITE_NAME')) {
    define('SITE_NAME', APP_NAME);
}
if (!defined('SITE_EMAIL')) {
    define('SITE_EMAIL', 'invest@avondcapital.org');
}

// Database Constants
if (!defined('DB_HOST')) {
    define('DB_HOST', 'localhost');
}
if (!defined('DB_NAME')) {
    define('DB_NAME', 'dcfinanc_avondex');
}
if (!defined('DB_USER')) {
    define('DB_USER', 'dcfinanc_adslord');
}
if (!defined('DB_PASS')) {
    define('DB_PASS', 'guardian123');
}

// Security
if (!defined('ENCRYPTION_KEY')) {
    define('ENCRYPTION_KEY', 'your-secret-key-here-change-this');
}
if (!defined('JWT_SECRET')) {
    define('JWT_SECRET', 'your-jwt-secret-key-change-this');
}
if (!defined('CSRF_TOKEN_NAME')) {
    define('CSRF_TOKEN_NAME', 'csrf_token');
}

// Paths
if (!defined('BASE_PATH')) {
    define('BASE_PATH', dirname(dirname(__FILE__)));
}
if (!defined('UPLOAD_PATH')) {
    define('UPLOAD_PATH', BASE_PATH . '/uploads/');
}
if (!defined('LOG_PATH')) {
    define('LOG_PATH', BASE_PATH . '/logs/');
}

// Investment Settings
if (!defined('MIN_DEPOSIT')) {
    define('MIN_DEPOSIT', 100.00);
}
if (!defined('MAX_DEPOSIT')) {
    define('MAX_DEPOSIT', 10000000.00);
}
if (!defined('MIN_WITHDRAWAL')) {
    define('MIN_WITHDRAWAL', 100.00);
}
if (!defined('WITHDRAWAL_FEE')) {
    define('WITHDRAWAL_FEE', 0.00); // 5%
}

// Referral Settings
if (!defined('REFERRAL_BONUS_AMOUNT')) {
    define('REFERRAL_BONUS_AMOUNT', 10.00);
}
if (!defined('REFERRAL_COMMISSION_RATE')) {
    define('REFERRAL_COMMISSION_RATE', 0.00); // 5%
}

// Email Settings
if (!defined('MAIL_FROM')) {
    define('MAIL_FROM', SITE_EMAIL);
}
if (!defined('MAIL_FROM_NAME')) {
    define('MAIL_FROM_NAME', SITE_NAME);
}

// SMTP Settings
if (!defined('SMTP_HOST')) {
    define('SMTP_HOST', 'mail.avondcapital.org');
}
if (!defined('SMTP_USERNAME')) {
    define('SMTP_USERNAME', 'invest@avondcapital.org');
}
if (!defined('SMTP_PASSWORD')) {
    define('SMTP_PASSWORD', 'Light@2026');
}
if (!defined('SMTP_ENCRYPTION')) {
    define('SMTP_ENCRYPTION', 'ssl');
}
if (!defined('SMTP_PORT')) {
    define('SMTP_PORT', 465);
}

// reCAPTCHA Settings
if (!defined('RECAPTCHA_SITE_KEY')) {
    define('RECAPTCHA_SITE_KEY', '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'); // localhost test key
}
if (!defined('RECAPTCHA_SECRET_KEY')) {
    define('RECAPTCHA_SECRET_KEY', '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'); // localhost test secret
}

// Error Reporting
if (defined('ENVIRONMENT') && ENVIRONMENT === 'production') {
    error_reporting(0);
    ini_set('display_errors', 0);
} else {
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    ini_set('log_errors', 1);
}

// Auto-loader for classes
spl_autoload_register(function ($class) {
    $file = BASE_PATH . '/includes/classes/' . str_replace('\\', '/', $class) . '.php';
    if (file_exists($file)) {
        require $file;
    }
});
?>