import { PersistentStore } from '../state/persistent-store.js';
import type { PermissionPromptDecision, PermissionPromptRequest, PermissionRequestHandler } from '../permissions/prompt.js';
import type { ControlPlaneSurfaceMessage } from './types.js';
export type SharedApprovalStatus = 'pending' | 'claimed' | 'approved' | 'denied' | 'cancelled' | 'expired';
export interface SharedApprovalAuditRecord {
    readonly id: string;
    readonly action: 'created' | 'claimed' | 'approved' | 'denied' | 'cancelled' | 'expired' | 'updated';
    readonly actor: string;
    readonly actorSurface?: string | undefined;
    readonly createdAt: number;
    readonly note?: string | undefined;
}
export interface SharedApprovalRecord {
    readonly id: string;
    readonly callId: string;
    readonly sessionId?: string | undefined;
    readonly routeId?: string | undefined;
    readonly status: SharedApprovalStatus;
    readonly request: PermissionPromptRequest;
    readonly createdAt: number;
    readonly updatedAt: number;
    readonly claimedBy?: string | undefined;
    readonly claimedAt?: number | undefined;
    readonly resolvedAt?: number | undefined;
    readonly resolvedBy?: string | undefined;
    readonly decision?: PermissionPromptDecision | undefined;
    readonly metadata: Record<string, unknown>;
    readonly audit: readonly SharedApprovalAuditRecord[];
}
interface SharedApprovalStoreSnapshot extends Record<string, unknown> {
    readonly approvals: readonly SharedApprovalRecord[];
}
export interface RequestSharedApprovalInput {
    readonly request: PermissionPromptRequest;
    readonly sessionId?: string | undefined;
    readonly routeId?: string | undefined;
    readonly metadata?: Record<string, unknown> | undefined;
    readonly localPrompt?: PermissionRequestHandler | undefined;
    readonly timeoutMs?: number | undefined;
}
type ApprovalListener = (approval: SharedApprovalRecord) => void;
type ApprovalPublisher = {
    publishEvent(event: string, payload: unknown): void;
    publishSurfaceMessage(message: Omit<ControlPlaneSurfaceMessage, 'id' | 'createdAt'>): void;
};
export declare class ApprovalBroker {
    private readonly store;
    private readonly approvals;
    private readonly pendingResolvers;
    private readonly listeners;
    private publisher;
    private loaded;
    constructor(options: {
        readonly store?: PersistentStore<SharedApprovalStoreSnapshot> | undefined;
        readonly storePath?: string | undefined;
    });
    subscribe(listener: ApprovalListener): () => void;
    setPublisher(publisher: ApprovalPublisher | null): void;
    start(): Promise<void>;
    listApprovals(limit?: number): SharedApprovalRecord[];
    getApproval(approvalId: string): SharedApprovalRecord | null;
    requestApproval(input: RequestSharedApprovalInput): Promise<PermissionPromptDecision>;
    claimApproval(approvalId: string, actor: string, actorSurface?: string, note?: string): Promise<SharedApprovalRecord | null>;
    resolveApproval(approvalId: string, input: {
        readonly approved: boolean;
        readonly remember?: boolean | undefined;
        readonly actor: string;
        readonly actorSurface?: string | undefined;
        readonly note?: string | undefined;
    }): Promise<SharedApprovalRecord | null>;
    recordRemoteUpdate(approvalId: string, input: {
        readonly actor: string;
        readonly actorSurface?: string | undefined;
        readonly note?: string | undefined;
        readonly metadata?: Record<string, unknown> | undefined;
    }): Promise<SharedApprovalRecord | null>;
    cancelApproval(approvalId: string, actor: string, actorSurface?: string, note?: string): Promise<SharedApprovalRecord | null>;
    private expireApproval;
    private persist;
    private publish;
}
export {};
//# sourceMappingURL=approval-broker.d.ts.map