package legacyid

import "testing"

func TestUUIDIsStableAndEntityScoped(t *testing.T) {
	department, err := UUID("python-v1", "departments", "42")
	if err != nil {
		t.Fatal(err)
	}
	if department != "028ac0aa-75d4-5ce6-b20d-15a343df445e" {
		t.Fatalf("unexpected deterministic UUID %q", department)
	}
	user, err := UUID("python-v1", "users", "42")
	if err != nil {
		t.Fatal(err)
	}
	if user != "de8453de-93b5-5ab9-8284-ed099894296b" || user == department {
		t.Fatalf("entity namespace was not applied: %q", user)
	}
}

func TestUUIDRejectsIncompleteIdentity(t *testing.T) {
	if _, err := UUID("python-v1", "users", " "); err == nil {
		t.Fatal("expected empty legacy ID to be rejected")
	}
}
