package graph_test

import (
	"testing"

	"bit.admedia.com/scm/ad/adpilot-indexing-commit-intel.com/internal/contracts/graph"
)

func TestDeltaCounts(t *testing.T) {
	delta := graph.Delta{
		SchemaVersion: graph.DeltaSchemaVersionV1,
		RepoID:        "ad/example",
		SnapshotID:    "snap_1",
		BaseCommitSHA: "base",
		TargetCommitSHA: "target",
		ChangedFiles:  []string{"main.go"},
		FileDeltas: []graph.FileDelta{
			{
				AddedNodes:   []graph.Node{{ID: "n1"}},
				RemovedNodes: []graph.Node{{ID: "n2"}},
				AddedEdges:   []graph.Edge{{ID: "e1"}},
			},
		},
	}

	added, removed, edges := delta.Counts()
	if added != 1 || removed != 1 || edges != 1 {
		t.Fatalf("counts: added=%d removed=%d edges=%d", added, removed, edges)
	}
}

func TestDeltaCountsEmpty(t *testing.T) {
	added, removed, edges := graph.Delta{}.Counts()
	if added != 0 || removed != 0 || edges != 0 {
		t.Fatalf("expected zero counts, got added=%d removed=%d edges=%d", added, removed, edges)
	}
}
