namespace NATS.Server.Tests;

public class DifferencesParityClosureTests
{
    [Fact]
    public void Differences_md_has_no_remaining_baseline_n_or_stub_rows_in_tracked_scope()
    {
        var report = Parity.ParityRowInspector.Load("differences.md");
        report.UnresolvedRows.ShouldBeEmpty(string.Join(
            Environment.NewLine,
            report.UnresolvedRows.Select(r => $"{r.Section} :: {r.SubSection} :: {r.Feature} [{r.DotNetStatus}]")));
    }

    [Fact]
    public void Jetstream_truth_matrix_has_no_row_level_drift()
    {
        var report = Parity.JetStreamParityTruthMatrix.Load(
            "differences.md",
            "docs/plans/2026-02-23-jetstream-remaining-parity-map.md");

        report.DriftRows.ShouldBeEmpty(string.Join(
            Environment.NewLine,
            report.DriftRows.Select(r => $"{r.Feature} [{r.DifferencesStatus}|{r.EvidenceStatus}] :: {r.Reason}")));
    }

    [Fact]
    public void Differences_and_strict_capability_maps_have_no_claims_without_behavior_and_test_evidence()
    {
        var inventory = Parity.NatsCapabilityInventory.Load("docs/plans/2026-02-23-nats-strict-full-go-parity-map.md");
        var incomplete = inventory.Rows
            .Where(r => !string.Equals(r.Behavior, "done", StringComparison.OrdinalIgnoreCase)
                        || !string.Equals(r.Tests, "done", StringComparison.OrdinalIgnoreCase)
                        || !string.Equals(r.Docs, "closed", StringComparison.OrdinalIgnoreCase))
            .ToArray();

        incomplete.ShouldBeEmpty(string.Join(
            Environment.NewLine,
            incomplete.Select(r => $"{r.Capability} [{r.Behavior}|{r.Tests}|{r.Docs}]")));
    }
}
