# Copyright (c) 2025, JINGROW and contributors
# For license information, please see license.txt

"""
Session whitelist functions - Forward to SaaS using unified HTTP client
"""

import jingrow
from jingrow.utils.auth import saas_get, saas_post


@jingrow.whitelist()
def get_boot_info():
    """Get boot info - Forward to SaaS"""
    resp = saas_get('/api/action/jingrow.sessions.get_boot_info')
    if resp.status_code == 200:
        return resp.json().get("message", {})
    return {}


@jingrow.whitelist()
def get_translations():
    """Get translations - Forward to SaaS"""
    resp = saas_get('/api/action/jingrow.sessions.get_translations')
    if resp.status_code == 200:
        return resp.json().get("message", {})
    return {}


@jingrow.whitelist()
def clear():
    """Clear user cache - Forward to SaaS"""
    resp = saas_post('/api/action/jingrow.sessions.clear')
    if resp.status_code == 200:
        return resp.json().get("message", {})
    return {}
