<?php
declare(strict_types=1);

/**
 * Competitor Intelligence Portal - configuration.
 * Machine-specific values go in config.local.php, which is git-ignored.
 */

// ---------------------------------------------------------------- database
define('DB_HOST', '127.0.0.1');
define('DB_PORT', 3306);
define('DB_NAME', 'competitor_portal');
define('DB_USER', 'comp');
define('DB_PASS', 'CoreFix1!');
define('DB_CHARSET', 'utf8mb4');

// ---------------------------------------------------------------- app
define('APP_NAME', 'Competitor Portal');
define('APP_ENV', 'development');            // development | production
define('APP_DEBUG', APP_ENV === 'development');
define('APP_TIMEZONE', 'Asia/Jerusalem');

/** Web path the portal is served from, no trailing slash. '' when it is the site root. */
define('BASE_URL', '');

/** Default interface language: 'en' or 'he'. Users can switch per session. */
define('DEFAULT_LANG', 'en');

// ---------------------------------------------------------------- auth
define('SESSION_NAME', 'cportal');
define('SESSION_IDLE_MINUTES', 120);         // logged out after this much inactivity
define('LOGIN_MAX_ATTEMPTS', 5);             // per username + IP
define('LOGIN_LOCKOUT_MINUTES', 15);
define('BCRYPT_COST', 12);
define('MIN_PASSWORD_LENGTH', 10);

// ---------------------------------------------------------------- access
/**
 * Optional network restriction. Empty = any source IP.
 * Internal-only deployment example: ['10.0.0.0/8', '192.168.0.0/16', '172.16.0.0/12'].
 */
define('IP_ALLOWLIST', []);

/** Set to true once the site is behind HTTPS so the session cookie is secure-only. */
define('COOKIE_SECURE', false);

// ---------------------------------------------------------------- monitoring
/** Default check interval offered when a company is put on watch. */
define('WATCH_DAYS_CORE', 90);               // overlaps our product line
define('WATCH_DAYS_OTHER', 180);
/** A check older than this is treated as stale regardless of schedule. */
define('STALE_AFTER_DAYS', 365);

// ---------------------------------------------------------------- paths
define('BASE_DIR', dirname(__DIR__));
define('UPLOAD_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'uploads');
define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');

define('PAGE_SIZE', 25);
define('PAGE_SIZE_MAX', 200);

if (is_file(__DIR__ . '/config.local.php')) {
    require __DIR__ . '/config.local.php';
}
