import type { BillingAdapter } from "./types.js"; export interface CloseWorkspaceOptions { /** * `"now"` (default) stops the billing immediately: the workspace is going away, so a * subscription outliving it is the failure this function exists to prevent. Stripe issues no * refund for the unused part — see the note above. * * `"period_end"` lets the customer keep the period they paid for, at the cost of a live * subscription attached to an org that is gone. Only safe with `deleteOrg: false`, and this * refuses the combination rather than creating the orphan itself. */ cancelAt?: "now" | "period_end"; /** Remove the WorkOS organization at the end. Default true. Needs `adapter.deleteOrg`. */ deleteOrg?: boolean; /** Clear this workspace's entries from each member's own metadata. Default true. */ clearMembers?: boolean; /** Recorded on the Stripe customer so the kept record explains itself. */ reason?: string; } export interface CloseWorkspaceResult { orgId: string; customerId: string | null; /** Subscription ids whose billing was stopped. */ cancelled: string[]; /** How each one ended, so a caller can tell "gone" from "ends later". */ endsAt: Record; /** Invoices left in place on purpose — the legal record. */ invoicesKept: number; /** Members whose per-workspace metadata was cleared. */ membersCleared: number; orgDeleted: boolean; /** Anything that could not be completed. Non-empty means finish by hand. */ warnings: string[]; } /** * Close `orgId`: stop its billing, keep its invoices, then remove it. * * Returns what happened rather than throwing, EXCEPT where continuing would create the orphan * it exists to prevent: if a subscription cannot be cancelled, the org is left in place and * the reason is in `warnings`. */ export declare function closeWorkspace(adapter: BillingAdapter, orgId: string, opts?: CloseWorkspaceOptions): Promise; /** * Live subscriptions whose org cannot be resolved any more — the wreckage of a workspace * deleted the old way. * * Bounded by subscriptions EXAMINED rather than orphans found, for the same reason the usage * scans are: an account with thousands of healthy subscriptions must not be walked in full to * answer a health question. */ export declare function findOrphanedSubscriptions(adapter: BillingAdapter, { examine }?: { examine?: number; }): Promise>; //# sourceMappingURL=close-workspace.d.ts.map