# backend/app/core/config.py
import os
from pwdlib import PasswordHash

DB_PATH = os.getenv("DB_PATH", "./tournaments.db")

# Security Config
SECRET_KEY = os.getenv("SECRET_KEY", "SUPER-SECRET-TOKEN")
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 60 * 24  # 24 hours

# Admin Credentials
ADMIN_USER = os.getenv("ADMIN_USER", "admin")
ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD", "admin")

# Ref Credentials
REF_USER = os.getenv("REF_USER", "ref")
REF_PASSWORD = os.getenv("REF_PASSWORD", "ref")

password_hash = PasswordHash.recommended()
ADMIN_HASH = password_hash.hash(ADMIN_PASSWORD)
REF_HASH = password_hash.hash(REF_PASSWORD)


def verify_password(plain_password, hashed_password):
    return password_hash.verify(plain_password, hashed_password)


def get_password_hash(password):
    return password_hash.hash(password)
