package server

import "context"

// RepositoryEvent is a product-neutral fact emitted by AGS after a repository
// operation. Embedders own all product policy, retries and projections.
type RepositoryEvent struct {
	RepositoryID uint
	Event        string
	Action       string
	PayloadJSON  []byte
}

type RepositoryEventSink interface {
	HandleRepositoryEvent(context.Context, RepositoryEvent) error
}

// WithRepositoryEventSink forwards canonical repository events to an embedder.
func WithRepositoryEventSink(sink RepositoryEventSink) Option {
	return func(opts *options) {
		opts.repositoryEventSink = sink
	}
}
