import os


BASE_DIR = os.path.dirname(os.path.abspath(__file__))


class Config:
    """Konfigurasi aplikasi.

    Semua path memakai BASE_DIR supaya aman saat dipasang di cPanel,
    di mana application root berada di luar public_html.
    """

    SECRET_KEY = os.environ.get("SA_SECRET_KEY", "sa-revived-prototype")

    DATABASE = os.environ.get("SA_DATABASE", os.path.join(BASE_DIR, "data", "seed.sqlite"))

    MODEL_PATH = os.path.join(BASE_DIR, "models", "tfidf_svc_stat3.pickle")
    VECTORIZER_PATH = os.path.join(BASE_DIR, "models", "tfidf_vectorizer_stat3.pickle")
    LEXICON_PATH = os.path.join(BASE_DIR, "models", "colloquial-indonesian-lexicon.csv")

    # Batas ukuran request (dipakai untuk endpoint demo).
    MAX_CONTENT_LENGTH = 4096
    DEMO_MAX_CHARS = 1000
    DEMO_RATE_LIMIT = 30  # maksimal request per menit per IP
