"""
Passenger WSGI entry point for cPanel shared hosting.

cPanel's Application Manager looks for a file named passenger_wsgi.py at the
Application Path root and expects it to expose a callable named `application`.

Layout on the server:
    /home/<user>/<app-dir>/          <- Application Path in cPanel
        passenger_wsgi.py            <- this file
        .env                         <- secrets / settings
        requirements.txt
        data/
            group_links.json
            referral_wait_state.json
        financegpt_bot/
            __init__.py
            app.py
            ...
"""

import os
import sys

# ---------------------------------------------------------------------------
# 1. Put the application root on sys.path so that `import financegpt_bot` works.
# ---------------------------------------------------------------------------
_app_root = os.path.dirname(os.path.abspath(__file__))
if _app_root not in sys.path:
    sys.path.insert(0, _app_root)

# ---------------------------------------------------------------------------
# 2. Expose the Flask app as the WSGI callable Passenger expects.
#    The variable MUST be named `application`.
# ---------------------------------------------------------------------------
from financegpt_bot.app import app as application  # noqa: E402
