declare const typeArray: readonly ["earned", "applied", "expired", "clawback", "manual_adjustment"]; export type ReferralCreditType = (typeof typeArray)[number]; /** * Signed ledger of referral credit — one row per money movement, balance is a SUM. * * The money is held here rather than pushed straight into the Stripe customer balance, because that * balance is a single number with no rules attached: no per-invoice cap, no expiry, and no clean * reversal. Keeping it here is what makes the 30%-per-invoice cap, the 12-month expiry and fraud * clawback enforceable. Each cycle only the slice that may be spent now * (`min(balance, 30% of the upcoming invoice subtotal)`) is pushed to Stripe as an `applied` row. * * `amountCents` is SIGNED: `earned` is positive, everything else negative. So: * available balance = SUM(amountCents) * total earned = SUM(amountCents) WHERE type = 'earned' * credit applied = -SUM(amountCents) WHERE type = 'applied' * A negative overall balance is meaningful — it is a clawback of credit that an invoice had already * consumed, and is settled by pushing a positive (debit) transaction to Stripe. */ export declare class ReferralCredit { id: number; /** Null for manual CS adjustments, which are not tied to a referral. */ referralId: number | null; clientId: number; /** Stripe customer the credit is pushed to. */ customerId: string | null; type: ReferralCreditType; /** SIGNED — `earned` positive, `applied` / `expired` / `clawback` negative. */ amountCents: number; issuedAt: Date; /** `issuedAt + 12 months`. Set on `earned` rows only. */ expiresAt: Date | null; /** * Stripe customer balance transaction id. Unique, which is what makes the per-cycle drip idempotent * — a retried run cannot double-apply. Also carries the debit id when a clawback is settled. */ stripeBalanceTxId: string | null; appliedInvoiceId: string | null; appliedAt: Date | null; /** CS user behind a manual adjustment or clawback. */ adjustedByUsername: string | null; note: string | null; createdAt: Date | null; updatedAt: Date | null; } export {};