package packs

import "context"

// Category identifies a pack's role in the platform.
type Category string

const (
	PlatformCore   Category = "platform-core"
	PlatformTenant Category = "platform-tenant"
	PlatformPolicy Category = "platform-policy"
	PlatformConfig Category = "platform-config"
	PlatformUX     Category = "platform-ux"
	DevSample      Category = "dev-sample"
)

// Pack is a typed, ordered unit of platform metadata that the control plane
// can apply and verify independently.
type Pack interface {
	Name() string
	Category() Category
	Apply(ctx context.Context, deps ApplyDeps) error
	Verify(ctx context.Context, deps VerifyDeps) error
}

// RuntimeRequiredPacks returns packs that must be present for the runtime
// server to function. Verify() checks only these. DevSample is excluded.
func RuntimeRequiredPacks() []Pack {
	return []Pack{
		&PlatformCorePack{},
		&PlatformPolicyPack{},
		&PlatformConfigPack{},
		&PlatformUXPack{},
	}
}

// AllPacks returns packs in dependency order. When includeDevSample is true
// the dev-only pack is appended at the end.
func AllPacks(includeDevSample bool) []Pack {
	p := RuntimeRequiredPacks()
	if includeDevSample {
		p = append(p, &DevSamplePack{})
	}
	return p
}
