import { PersistentStore } from '@pellux/goodvibes-sdk/platform/state/persistent-store';
import type { PermissionPromptDecision, PermissionPromptRequest, PermissionRequestHandler } from '../permissions/prompt.js';
import type { ControlPlaneSurfaceMessage } from '@pellux/goodvibes-sdk/platform/control-plane/types';
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;
    readonly createdAt: number;
    readonly note?: string;
}
export interface SharedApprovalRecord {
    readonly id: string;
    readonly callId: string;
    readonly sessionId?: string;
    readonly routeId?: string;
    readonly status: SharedApprovalStatus;
    readonly request: PermissionPromptRequest;
    readonly createdAt: number;
    readonly updatedAt: number;
    readonly claimedBy?: string;
    readonly claimedAt?: number;
    readonly resolvedAt?: number;
    readonly resolvedBy?: string;
    readonly decision?: PermissionPromptDecision;
    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;
    readonly routeId?: string;
    readonly metadata?: Record<string, unknown>;
    readonly localPrompt?: PermissionRequestHandler;
    readonly timeoutMs?: number;
}
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>;
        readonly storePath?: string;
    });
    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;
        readonly actor: string;
        readonly actorSurface?: string;
        readonly note?: string;
    }): Promise<SharedApprovalRecord | null>;
    recordRemoteUpdate(approvalId: string, input: {
        readonly actor: string;
        readonly actorSurface?: string;
        readonly note?: string;
        readonly metadata?: Record<string, unknown>;
    }): 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