package contract

import "context"

type RecordCacheInvalidationChange struct {
	Before Record
	After  Record
}

type RecordCacheInvalidationEvent struct {
	ObjectName string
	Changes    []RecordCacheInvalidationChange
}

type RecordCacheInvalidationPlan struct {
	InvalidatePermissions bool
	InvalidateSharing     bool
	RefreshRoleHierarchy  bool
	UserIDs               []string
}

type RecordCacheInvalidationHandler func(context.Context, RecordCacheInvalidationEvent) (RecordCacheInvalidationPlan, error)

type RecordCacheInvalidationRegistrar interface {
	RegisterRecordCacheInvalidation(RecordCacheInvalidationRegistration) error
}

type RecordCacheInvalidationRegistration struct {
	Capability string
	Handler    RecordCacheInvalidationHandler
}
