import Stripe from 'stripe';
import { ChargeRequest, RefundRequest, ProviderEvent, ProviderFactory } from './index.js';
import '@platform-modules/db';
import '@platform-modules/ledger';

type StripeCreds = {
    secretKey: string;
    webhookSecret: string;
    stripe?: Stripe;
    apiVersion?: string;
    /** Host-owned lookup when refund requests omit `paymentIntentId`. */
    resolvePaymentIntentId?: (chargeKey: string) => string | Promise<string>;
};
/** Stripe refund calls need the original PaymentIntent id (pi_…). */
type StripeRefundRequest = RefundRequest & {
    paymentIntentId?: string;
};
/**
 * Structured, charge-time-only Stripe Connect inputs. These MONEY-ROUTING
 * fields ride a TYPED request extension — NEVER `metadata` (spec floor #6 /
 * request-extension pattern). `metadata` is a caller-supplied
 * `Record<string,string>`; reading `transfer_data.destination` from it let any
 * caller who could set a metadata key REDIRECT the payout to an arbitrary
 * Connect account (a funds-redirect authorization hole). The adapter now reads
 * the destination/fee ONLY from this typed field and IGNORES the metadata path.
 */
type StripeChargeExtras = {
    /** Connect account that receives the transfer (acct_…). Routes money → typed, never metadata. */
    connectDestination?: string;
    /** Platform application fee in minor units, retained on the platform. */
    applicationFeeAmount?: number;
};
type StripeChargeRequest = ChargeRequest & {
    stripe?: StripeChargeExtras;
};
declare function classifyStripeEvent(event: Stripe.Event, client: Stripe): Promise<ProviderEvent>;
declare const stripe: ProviderFactory;

export { type StripeChargeExtras, type StripeChargeRequest, type StripeCreds, type StripeRefundRequest, classifyStripeEvent, stripe };
