//! Tenancy resolution.
//!
//! GuruConnect v2 ships a tenancy-*ready* schema: every scoped table carries a
//! nullable `tenant_id`, and a single fixed default tenant exists. Isolation is
//! NOT enforced in Phase 1 - every call resolves to the default tenant here.
//!
//! Phase 4 (multi-tenancy activation) flips this module to resolve the tenant
//! from the authenticated principal (viewer JWT claim / per-agent key row)
//! instead of returning the constant. Keeping the resolution behind a single
//! function means no schema rewrite and no scattered call-site changes.

use uuid::Uuid;

/// The fixed default tenant UUID.
///
/// Must stay in lockstep with the seed row in
/// `migrations/004_v2_secure_session_core.sql`
/// (`00000000-0000-0000-0000-000000000001`).
pub const DEFAULT_TENANT_ID: Uuid = Uuid::from_u128(0x0000_0000_0000_0000_0000_0000_0000_0001);

/// Resolve the tenant for the current operation.
///
/// PHASE-4 SWITCH POINT: today this unconditionally returns
/// [`DEFAULT_TENANT_ID`]. When multi-tenancy is activated, replace the body
/// with resolution from the authenticated principal; the signature should grow
/// the principal/context argument at that time. All scoped inserts route their
/// `tenant_id` through this function so the cutover is localized here.
#[allow(dead_code)] // Wired into inserts as call sites adopt tenancy (Tasks 2-4); single Phase-4 switch point.
pub fn current_tenant_id() -> Uuid {
    DEFAULT_TENANT_ID
}
