"""Production configuration — https://investasi.kamu.co.id"""
from config.default import *  # noqa: F401,F403

DEBUG = False

# --- Session Security (HTTPS) ---
SESSION_COOKIE_SECURE = True          # Cookie hanya via HTTPS
SESSION_COOKIE_HTTPONLY = True         # Tidak bisa diakses JavaScript
SESSION_COOKIE_SAMESITE = 'Lax'       # Proteksi CSRF

# --- Remember Me Cookie (Flask-Login) ---
REMEMBER_COOKIE_SECURE = True         # Remember-me via HTTPS only
REMEMBER_COOKIE_HTTPONLY = True

# --- URL Scheme ---
PREFERRED_URL_SCHEME = 'https'        # url_for() generate https://

# --- SQLAlchemy Production Tuning (Low-spec: 1GB RAM) ---
SQLALCHEMY_ENGINE_OPTIONS = {
    'pool_size': 3,           # Was 20 — 3 persistent connections max
    'pool_recycle': 1800,     # Recycle every 30 min (MySQL wait_timeout)
    'pool_pre_ping': True,    # Detect dead connections
    'max_overflow': 2,        # Was 10 — max 5 total (3+2)
    'pool_timeout': 10,       # Wait max 10s for connection
}

# --- ML Engine Tuning (Low-spec override) ---
# Kalau upgrade server ke 2GB+, hapus block ini supaya pakai default.py
ML_GB_ESTIMATORS = 50           # Default 100 — hemat RAM
ML_TREE_ESTIMATORS = 50         # Default 200 — hemat RAM
ML_MAX_DEPTH = 4                # Default 6 — shallower trees
ML_SEQ_LENGTH = 16              # Default 24 — smaller feature matrices
ML_RETRAIN_MINUTES = 120        # Default 60 — less frequent retraining
ML_PREDICT_STEPS = 24           # Default 48 — shorter horizon
ML_OHLCV_LIMIT = 500            # Default 1000 — less data in memory
