"""Guided-tour versioning.

Bump this when the back office changes enough that staff should be walked
through it again; everyone whose ``tour_seen_version`` is lower is re-offered
the tour on their next visit.
"""
# v2 is the walkthrough rian scripted (2026-08-28); v1 testers are re-offered.
TOUR_VERSION = 3

TOUR_ENABLED = True


def should_offer_tour(user):
    if not TOUR_ENABLED:
        return False
    return bool(
        getattr(user, "is_authenticated", False)
        and user.is_staff
        and getattr(user, "tour_seen_version", 0) < TOUR_VERSION
    )
