import { BillingAlertSettings, BillingCreditNotificationDetails, BillingCreditNotificationKind, type BillingCreditNotification } from "@opengeni/contracts/billing-credit-notifications"; import { type Database } from "./database.js"; export declare function unusualCreditSpend(input: { historyHours: number; baselineSpendMicros: number; lastHourSpendMicros: number; }): boolean; export declare function getBillingAlertSettings(db: Database, accountId: string): Promise; export declare function updateBillingAlertSettings(db: Database, input: BillingAlertSettings): Promise; export type EnqueueBillingCreditNotificationInput = { accountId: string; /** Stable, caller-owned key, e.g. topup::failed. Never a timestamp on retry. */ operationKey: string; kind: BillingCreditNotificationKind; details: BillingCreditNotificationDetails; }; /** May use a caller's transaction: receipt, recipients and charge result can commit together. */ export declare function enqueueBillingCreditNotification(db: Database, input: EnqueueBillingCreditNotificationInput): Promise; /** Bounded ID-only discovery from the existing runtime-readable organization * registry, also covering a first failed top-up with no ledger entry yet. */ export declare function listBillingCreditAlertAccounts(db: Database, afterAccountId?: string | null, limit?: number): Promise; /** Sample once per minute, serializing canonical balance and the crossing receipt. */ export declare function evaluateBillingCreditAlerts(db: Database, accountId: string): Promise; export declare function listBillingCreditNotifications(db: Database, input: { accountId: string; subjectId: string; }): Promise; export declare function markBillingCreditNotificationRead(db: Database, input: { accountId: string; subjectId: string; notificationId: string; }): Promise; export type BillingCreditEmailMessage = { from: string; to: string; subject: string; text: string; html: string; }; export declare function billingCreditActionPath(personalWorkspaceId: string | null): string; export type BillingCreditDeliveryClaim = { id: string; accountId: string; claimId: string; subjectId: string; email: string; message: BillingCreditEmailMessage; }; /** Claims commit before I/O. Stable key + immutable payload + provider scope and * retention deadline make crash recovery safe; expired ambiguity is never resent. */ export declare function claimBillingCreditNotification(db: Database, input: { accountId: string; sender: string; providerScope: string; retentionSeconds: number; message: (kind: BillingCreditNotificationKind, details: BillingCreditNotificationDetails, email: string, actionPath: string) => BillingCreditEmailMessage; }): Promise; /** Hold the canonical membership fence through dispatch admission and bounded * waiting. A revocation committed before this fence prevents I/O; an admitted * transport may still finish after the caller stops waiting. */ export declare function withBillingCreditDeliveryAuthority(db: Database, claim: BillingCreditDeliveryClaim, send: () => Promise): Promise; export declare function settleBillingCreditNotification(db: Database, claim: BillingCreditDeliveryClaim, result: { status: "sent" | "failed" | "outcome_unknown" | "suppressed"; providerMessageId?: string | null; errorClass?: string; }): Promise;