import type { LTEscalationRecord } from '../../types';
import type { CreateEscalationInput, ClaimResult } from './types';
export declare function createEscalation(input: CreateEscalationInput): Promise<LTEscalationRecord>;
/**
 * Atomic claim operation. Does NOT change status — "claimed" is implicit
 * via assigned_to + assigned_until > NOW().
 *
 * Conditions:
 * - status = 'pending' (not resolved/cancelled)
 * - Either: unassigned, expired claim, or same user (extension)
 *
 * Uses a CTE to capture the previous state so callers can detect extensions.
 */
export declare function claimEscalation(id: string, userId: string, durationMinutes?: number): Promise<ClaimResult | null>;
export declare function resolveEscalation(id: string, resolverPayload: Record<string, any>): Promise<LTEscalationRecord | null>;
/**
 * Bulk update priority for a set of escalations.
 * Only updates pending escalations.
 */
export declare function updateEscalationsPriority(ids: string[], priority: 1 | 2 | 3 | 4): Promise<number>;
/**
 * Get the distinct roles for a set of escalation IDs.
 * Used for permission validation before bulk operations.
 */
export declare function getEscalationRoles(ids: string[]): Promise<string[]>;
/**
 * Release a single escalation claim back to the available pool.
 * Only the assigned user (or superadmin via route) may release.
 */
export declare function releaseEscalation(id: string, userId: string): Promise<LTEscalationRecord | null>;
export declare function releaseExpiredClaims(): Promise<number>;
/**
 * Reassign an escalation to a different role.
 * Clears the current assignment so it becomes available to the new role.
 */
export declare function escalateToRole(id: string, targetRole: string): Promise<LTEscalationRecord | null>;
export declare function getEscalation(id: string): Promise<LTEscalationRecord | null>;
export declare function getEscalationsByTaskId(taskId: string): Promise<LTEscalationRecord[]>;
export declare function getEscalationsByWorkflowId(workflowId: string): Promise<LTEscalationRecord[]>;
export declare function updateEscalationMetadata(id: string, patch: Record<string, any>): Promise<LTEscalationRecord | null>;
export declare function enrichEscalationRouting(id: string, metadataPatch: Record<string, any>, workflowFields: {
    workflowType?: string;
    workflowId?: string;
    taskQueue?: string;
    taskId?: string;
}): Promise<LTEscalationRecord | null>;
export declare function getEscalationsByOriginId(originId: string): Promise<LTEscalationRecord[]>;
