package packs

import "testing"

// Frontend source supply is verified by app-packs and the frontend provisioner.
// Controlplane owns rejection of unsupported metadata components; this proof
// must not depend on a Core checkout or a particular L1 frontend distribution.
func TestFrontendSourceManifestRemainsUnsupportedPackComponent(t *testing.T) {
	if DefaultSourceBackedComponentKindRegistry().Supports(ComponentKindFrontendSourceManifest) {
		t.Fatalf("source-backed kind registry supports %q; frontend source manifests have no metadata apply/verify surface", ComponentKindFrontendSourceManifest)
	}
	if _, ok := ComponentKindContractFor(ComponentKindFrontendSourceManifest); ok {
		t.Fatalf("component-kind contracts include %q; frontend source manifests must not become an installable package kind without a real apply/verify surface", ComponentKindFrontendSourceManifest)
	}
	if _, ok := DefaultSourceBackedComponentCapabilityRegistry().CapabilityFor(ComponentKindFrontendSourceManifest); ok {
		t.Fatalf("source-backed capabilities include %q; frontend source manifests must stay out of the public package contract for now", ComponentKindFrontendSourceManifest)
	}
	if _, ok := appPackInstallableComponentKinds()[ComponentKindFrontendSourceManifest]; ok {
		t.Fatalf("app-pack installability includes %q; frontend source manifests belong to frontend distribution assembly", ComponentKindFrontendSourceManifest)
	}

	root := writePackFixture(t, "frontend-source-pack", validPackManifest(`[
    {
      "kind": "frontend_source_manifest",
      "businessKey": "frontend/source-manifest.json",
      "manageability": "locked",
      "payload": {"manifest":"frontend/source-manifest.json"}
    }
  ]`, `"dependencies": [],`))
	report := ValidatePackSourceWithOptions("local_path:"+root, testPackSourceOptions(t))
	assertDiagnostic(t, report, "component.kind.unsupported")
}
