"""Activate — license registration + renewal.

Lives in the sidebar nav under an underscore-prefixed filename so
Streamlit sorts it above the numbered tool pages. The chrome's
license gate also injects the activation form inline on any other
page when no valid license is present; this page exists so a user
can revisit the form without hitting an expiration first (e.g., to
review renewal status or deactivate the device).
"""

from __future__ import annotations

import sys
from pathlib import Path

import streamlit as st

_project_root = Path(__file__).resolve().parent.parent.parent.parent
if str(_project_root) not in sys.path:
    sys.path.insert(0, str(_project_root))

from src.gui.components import (
    hide_streamlit_chrome,
    render_activation_form,
    render_sticky_footer,
)
from src.i18n import t

from pathlib import Path as _Path
_ICON_PATH = str(_Path(__file__).parent.parent / "assets" / "datatools_icon_256.png")
st.set_page_config(
    page_title=t("activation.page_title"),
    page_icon=_ICON_PATH,
    layout="wide",
)

# ``gate_license=False`` keeps the chrome from re-rendering the
# activation form on top of the form we're about to render below.
hide_streamlit_chrome(gate_license=False)
render_sticky_footer()
render_activation_form(key_prefix="page")
