import type { SupplierCommitmentPolicyV1, SupplierOperationKindV1, SupplierOperationRecordV1, SupplierOperationStateV1, SupplierOperationSubjectTypeV1 } from "@voyant-travel/catalog-contracts/booking-engine/supplier-operations"; import type { PostgresJsDatabase } from "drizzle-orm/postgres-js"; export interface SupplierOperationInternalRecord { id: string; subjectType: SupplierOperationSubjectTypeV1; subjectId: string; sessionId?: string; scopeKey: string; quoteId?: string; holdId?: string; bookingItemId?: string; amendmentId?: string; idempotencyKey: string; operationKind: SupplierOperationKindV1; state: SupplierOperationStateV1; commitmentPolicy: SupplierCommitmentPolicyV1; entityModule: string; entityId: string; sourceKind: string; sourceConnectionId: string; sourceRef: string; adapterKind: string; requestFingerprint: string; adapterIdempotencyKey: string; requestPayload: Record; version: number; attemptCount: number; upstreamRef?: string; upstreamStatus?: string; bookingId?: string; lastErrorClass?: string; safeEvidence: Record; submittedAt?: Date; lastCheckedAt?: Date; sourceUpdatedAt?: Date; nextReconcileAt?: Date; resolvedAt?: Date; resolvedBy?: string; resolutionReason?: string; createdAt: Date; updatedAt: Date; } export type CreateSupplierOperationResult = { status: "created"; operation: SupplierOperationInternalRecord; } | { status: "replay"; operation: SupplierOperationInternalRecord; } | { status: "conflict"; }; export interface SupplierOperationRepository { createOrReplay(record: SupplierOperationInternalRecord): Promise; get(operationId: string): Promise; getByIdempotency(subjectType: SupplierOperationSubjectTypeV1, subjectId: string, idempotencyKey: string, scopeKey?: string): Promise; getBySession(sessionId: string): Promise; getBlockingBySession(sessionId: string, scopeKey?: string): Promise; getForUpdate(operationId: string): Promise; list(input: { state?: SupplierOperationStateV1; sessionId?: string; amendmentId?: string; limit: number; }): Promise; claimDispatch(operationId: string, at: Date): Promise; save(record: SupplierOperationInternalRecord): Promise; } export declare function createDrizzleSupplierOperationRepository(db: PostgresJsDatabase): SupplierOperationRepository; export declare function createSupplierOperationRecord(input: { subjectType: SupplierOperationSubjectTypeV1; subjectId: string; sessionId?: string; scopeKey?: string; quoteId?: string; holdId?: string; bookingId?: string; bookingItemId?: string; amendmentId?: string; idempotencyKey: string; operationKind: SupplierOperationKindV1; commitmentPolicy?: SupplierCommitmentPolicyV1; entityModule: string; entityId: string; sourceKind: string; sourceConnectionId: string; sourceRef: string; adapterKind: string; requestFingerprint: string; adapterIdempotencyKey: string; requestPayload: Record; upstreamRef?: string; now: Date; }): SupplierOperationInternalRecord; export declare function serializeSupplierOperation(operation: SupplierOperationInternalRecord): SupplierOperationRecordV1;