from jose import jwt
from datetime import datetime, timedelta

SECRET_KEY = "supersecretkey"
ALGORITHM = "HS256"

def create_jwt_token(email: str, role: str):
    expire = datetime.utcnow() + timedelta(hours=1)
    to_encode = {"sub": email, "role": role, "exp": expire}
    return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)