package applayoutbundleauthorityv1

import (
	"reflect"
	"testing"
)

func TestEvidenceSurfaceIsExact(t *testing.T) {
	assertExactFields(t, reflect.TypeOf(Evidence{}), []string{
		"EvidenceVersion",
		"SourceCatalogSnapshot",
		"BundleKey",
		"AppInstallationID",
		"AppReleaseDigest",
		"DeclarationComponentID",
		"DefinitionVersion",
		"LayoutBundleSlotRevisionDigest",
	})
	assertExactFields(t, reflect.TypeOf(BundleKey{}), []string{
		"BundleKeyVersion",
		"SlotOwnerKind",
		"SlotOwnerNamespace",
		"LocalComponentKey",
	})
}

func assertExactFields(t *testing.T, typ reflect.Type, expected []string) {
	t.Helper()
	if typ.NumField() != len(expected) {
		t.Fatalf("%s field count = %d, want %d", typ, typ.NumField(), len(expected))
	}
	for index, fieldName := range expected {
		if got := typ.Field(index).Name; got != fieldName {
			t.Fatalf("%s field %d = %s, want %s", typ, index, got, fieldName)
		}
	}
}
