import streamlit as st

from VerifierApp.config import init_directories
from VerifierApp.ui.data_management import render_data_management
from VerifierApp.ui.testing import render_testing
from VerifierApp.ui.history import render_history
from VerifierApp.core import job_manager
from VerifierApp.localisation_module import t, render_language_switcher, ICONS

st.set_page_config(page_title="LLM Bio-Model Verifier", page_icon=ICONS["page_icon"], layout="wide")

init_directories()

render_language_switcher()

st.sidebar.title(f"{ICONS['app']} {t('app_title')}")

# Background jobs badge
active_jobs = job_manager.get_active_count()
if active_jobs > 0:
    st.sidebar.info(f"{ICONS['jobs']} {t('testing_bg_jobs_header')}: **{active_jobs}** running")

nav_options = {
    t("nav_testing"): "testing",
    t("nav_data"): "data",
    t("nav_history"): "history",
}

page_label = st.sidebar.radio(t("nav_label"), list(nav_options.keys()))
page = nav_options[page_label]

if page == "data":
    render_data_management()
elif page == "testing":
    render_testing()
elif page == "history":
    render_history()