package plugin

// AllSources returns a snapshot of every registered Source keyed by kind.
// Snapshot semantics: the caller may iterate freely without holding any
// lock. Mutating the returned map does not affect the registry.
func AllSources() map[string]Source {
	sourcesMu.RLock()
	defer sourcesMu.RUnlock()
	out := make(map[string]Source, len(sources))
	for k, v := range sources {
		out[k] = v
	}
	return out
}

// AllTriggers returns a snapshot of every registered Trigger keyed by kind.
// Used by the single webhook ingress to fan an InboundEvent out across all
// triggers without per-call locking.
func AllTriggers() map[string]Trigger {
	triggersMu.RLock()
	defer triggersMu.RUnlock()
	out := make(map[string]Trigger, len(triggers))
	for k, v := range triggers {
		out[k] = v
	}
	return out
}
