import { WorkflowDedupClient } from '@openhi/workflows';
import { EventBridgeEvent } from 'aws-lambda';
import { C as CounterMutation } from './counter-apply-operation-DZM3MIDm.js';

/**
 * @see sites/www-docs/content/packages/@openhi/constructs/workflows/control-plane/counter-maintenance/counter-maintenance-handler.md
 *
 * ADR-028 counter-maintenance consumer. Invoked once per control-plane
 * domain event on the control event bus. Dedupes the event on
 * `(consumerName, eventId, attempt)` via the TR-015 `WorkflowDedupTable`,
 * then applies the resolved atomic-ADD counter deltas to the affected
 * canonical Tenant / Workspace / User records.
 *
 * Idempotency: an atomic ADD is not idempotent, so a replayed event must
 * be a no-op. `recordIfAbsent` is the circuit-breaker — when it returns
 * `recorded: false` a prior delivery of this exact `(eventId, attempt)`
 * already applied the deltas, so the handler exits without re-applying.
 * The dedup write happens-before the counter mutations, exactly as
 * ADR-028 § Consume requires.
 */
type CounterMaintenanceEvent = EventBridgeEvent<string, unknown>;
/** Dependency seam for tests; production wires the real dedup client. */
interface CounterMaintenanceDependencies {
    readonly dedupClient: WorkflowDedupClient;
    /**
     * Apply one resolved counter mutation. Defaults to
     * {@link applyCounterDeltaOperation}; tests inject a spy.
     */
    readonly applyMutation: (mutation: CounterMutation) => Promise<void>;
}
/**
 * Test-visible orchestrator. The production `handler` calls this with
 * real dependencies; unit tests inject fakes.
 */
declare const runCounterMaintenance: (event: CounterMaintenanceEvent, deps: CounterMaintenanceDependencies) => Promise<void>;
declare const handler: (event: CounterMaintenanceEvent) => Promise<void>;

export { type CounterMaintenanceDependencies, handler, runCounterMaintenance };
