-- Regression test: tri-state prov_strength formula (v0.1.2)
-- Verifies: no-prov→0.0, commit-only→0.4, commit+verified→1.0
-- Tests the CASE expression directly (no live table required).

SELECT
    CASE
        WHEN NULL::TEXT IS NOT NULL AND NULL::TIMESTAMPTZ IS NOT NULL THEN 1.0
        WHEN NULL::TEXT IS NOT NULL                                   THEN 0.4
        ELSE                                                               0.0
    END AS prov_no_prov,
    CASE
        WHEN 'abc123'::TEXT IS NOT NULL AND NULL::TIMESTAMPTZ IS NOT NULL THEN 1.0
        WHEN 'abc123'::TEXT IS NOT NULL                                   THEN 0.4
        ELSE                                                                   0.0
    END AS prov_commit_only,
    CASE
        WHEN 'abc123'::TEXT IS NOT NULL AND NOW() IS NOT NULL THEN 1.0
        WHEN 'abc123'::TEXT IS NOT NULL                       THEN 0.4
        ELSE                                                       0.0
    END AS prov_commit_verified;

-- Verify ordering: no_prov < commit_only < commit_verified
SELECT
    0.0 < 0.4  AS no_prov_lt_commit_only,
    0.4 < 1.0  AS commit_only_lt_fully_verified;

-- Verify 0.1×prov contribution difference: commit-only yields 0.01 less than full
SELECT
    round((0.1 * 1.0 - 0.1 * 0.4)::numeric, 4) AS delta_score_full_vs_commit_only,
    round((0.1 * 0.4 - 0.1 * 0.0)::numeric, 4) AS delta_score_commit_only_vs_none;
