import { SmrtObject } from '@happyvertical/smrt-core'; import { JsonObject, Subscriber, SubscriberKind, SubscriptionStatus, TenantSubscriptionOptions } from '../types.js'; export declare class TenantSubscription extends SmrtObject { tenantId?: string; /** * Discriminator for the subscriber identity. * * - `'tenant'` (default): the subscriber IS the owning `tenantId` — the * pre-polymorphic shape. All existing rows continue to behave this way. * - `'external'`: the subscriber is `subscriberExternalId`, scoped under the * issuing `tenantId`. Used for B2C buyers, anonymous-email subscribers, * agent identities, and any other caller-defined identity. */ subscriberKind: SubscriberKind; /** * Caller-namespaced opaque identifier for the subscriber when * `subscriberKind === 'external'`. Empty string when kind is `'tenant'`. * * The package treats this as opaque — no FK, no inferred semantics. Callers * are expected to namespace (e.g. `buyer-contact:abc123`, * `agent:hermes-7`, `email:foo@example.com`). */ subscriberExternalId: string; planId: string; status: SubscriptionStatus; startedAt: Date; currentPeriodStart: Date | null; currentPeriodEnd: Date | null; trialEndsAt: Date | null; cancelAtPeriodEnd: boolean; canceledAt: Date | null; externalProvider: string; stripeCustomerId: string; stripeSubscriptionId: string; stripeCheckoutSessionId: string; metadata: string; constructor(options?: TenantSubscriptionOptions); /** * Validates the subscriber XOR invariant before every save. Critical for the * generated update path: `SmrtCollection.update()` mutates the existing * instance via `Object.assign()` and calls `save()` directly — the * constructor never re-runs, so without this hook a partial update like * `{ subscriberExternalId: 'buyer:alice' }` on a tenant-kind row would * persist a malformed conflict key and let two tenant-kind rows coexist * under the same tenant. */ protected validateBeforeSave(): Promise; isEntitled(now?: Date): boolean; /** * Project this row's polymorphic subscriber columns onto the * {@link Subscriber} discriminated union. Returns `null` when the owning * tenant is absent — that's an invalid row that should not be acted on. */ getSubscriber(): Subscriber | null; getMetadata(): JsonObject; setMetadata(metadata: JsonObject): void; } export default TenantSubscription; //# sourceMappingURL=TenantSubscription.d.ts.map