#!/usr/bin/env python3
"""
Generate password hash for StreamA2026

Usage:
    python generate_password_hash.py <password>

Example:
    python generate_password_hash.py MyPassword123!
"""
import sys
import getpass
from pathlib import Path

# Add project root to path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root / "backend"))

from backend.app.auth import get_password_hash


def main():
    if len(sys.argv) > 1:
        password = sys.argv[1]
    else:
        password = getpass.getpass("Enter password: ")
    
    if not password:
        print("ERROR: Password cannot be empty")
        sys.exit(1)
    
    password_hash = get_password_hash(password)
    
    print(f"Password: {password}")
    print(f"Hash: {password_hash}")
    print("\nUse this hash with add_user_with_hash.py to create a user")


if __name__ == "__main__":
    main()
