import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes } from 'sequelize'; import type { LiteralUnion } from 'type-fest'; import { TenantModel } from '../tenant-model'; import type { CreditScheduleState, PaymentDetails, PaymentSettings, PriceRecurring, ServiceAction, SubscriptionBillingThresholds } from './types'; export declare const nextSubscriptionId: (size?: number) => string; export declare class Subscription extends TenantModel, InferCreationAttributes> { id: CreationOptional; livemode: boolean; instance_did?: string; currency_id: string; customer_id: string; current_period_end: number; current_period_start: number; default_payment_method_id: string; description?: string; latest_invoice_id?: string; metadata: Record; pending_setup_intent?: string; pending_update?: { billing_cycle_anchor?: number; expires_at?: number; subscription_items?: any[]; trial_end?: number; [key: string]: any; }; status: LiteralUnion<'active' | 'past_due' | 'paused' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'trialing', string>; cancel_at_period_end: boolean; cancel_at: CreationOptional; canceled_at: CreationOptional; cancelation_details?: { comment: string; feedback: LiteralUnion<'too_expensive' | 'missing_features' | 'switched_service' | 'unused' | 'customer_service' | 'too_complex' | 'low_quality' | 'other', string>; reason: LiteralUnion<'cancellation_requested' | 'payment_disputed' | 'payment_failed' | 'stake_revoked', string>; return_stake?: boolean; slash_stake?: boolean; slash_reason?: string; refund?: LiteralUnion<'last' | 'proration' | 'none', string>; requested_by?: string; }; billing_cycle_anchor: number; billing_thresholds?: SubscriptionBillingThresholds; collection_method: LiteralUnion<'charge_automatically' | 'send_invoice', string>; days_until_due?: number; days_until_cancel?: number; discount_id?: string; next_pending_invoice_item_invoice?: number; pause_collection?: { behavior: LiteralUnion<'keep_as_draft' | 'mark_uncollectible' | 'void', string>; resumes_at: number; }; payment_settings?: PaymentSettings; pending_invoice_item_interval: PriceRecurring; schedule_id?: string; ended_at?: number; start_date: number; trial_end?: number; trial_start?: number; trial_settings?: { end_behavior: { missing_payment_method: LiteralUnion<'cancel' | 'pause' | 'create_invoice', string>; }; }; payment_details?: PaymentDetails; slippage_config?: { mode?: 'percent' | 'rate'; percent?: number; min_acceptable_rate?: string; base_currency?: string; updated_at_ms?: number; } | null; proration_behavior?: LiteralUnion<'always_invoice' | 'create_prorations' | 'none', string>; payment_behavior?: LiteralUnion<'allow_incomplete' | 'error_if_incomplete' | 'pending_if_incomplete', string>; service_actions?: ServiceAction[]; recovered_from?: string; channel?: LiteralUnion<'stripe' | 'arcblock' | 'ethereum' | 'base' | 'app_store' | 'google_play', string>; environment?: LiteralUnion<'production' | 'sandbox', string>; created_at: CreationOptional; updated_at: CreationOptional; overdraft_protection?: { enabled: boolean; payment_method_id: string; payment_details: PaymentDetails; }; credit_schedule_state?: CreditScheduleState; static readonly GENESIS_ATTRIBUTES: { id: { type: DataTypes.StringDataType; primaryKey: boolean; allowNull: boolean; defaultValue: (size?: number) => string; }; livemode: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; currency_id: { type: DataTypes.StringDataType; allowNull: boolean; }; customer_id: { type: DataTypes.StringDataType; allowNull: boolean; }; cancel_at_period_end: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; current_period_end: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; current_period_start: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; default_payment_method_id: { type: DataTypes.StringDataType; allowNull: boolean; }; description: { type: DataTypes.StringDataType; allowNull: boolean; }; latest_invoice_id: { type: DataTypes.StringDataType; allowNull: boolean; }; pending_setup_intent: { type: DataTypes.StringDataType; allowNull: boolean; }; pending_update: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; status: { type: DataTypes.EnumDataType<"active" | "canceled" | "past_due" | "paused" | "incomplete" | "incomplete_expired" | "trialing">; allowNull: boolean; }; cancel_at: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; canceled_at: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; cancelation_details: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; billing_cycle_anchor: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; billing_thresholds: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; collection_method: { type: DataTypes.EnumDataType<"charge_automatically" | "send_invoice">; allowNull: boolean; }; slippage_config: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; days_until_due: { type: DataTypes.NumberDataTypeConstructor; allowNull: boolean; }; discount_id: { type: DataTypes.StringDataType; allowNull: boolean; }; next_pending_invoice_item_invoice_id: { type: DataTypes.StringDataType; allowNull: boolean; }; pause_collection: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; payment_settings: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; pending_invoice_item_interval: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; schedule_id: { type: DataTypes.StringDataType; allowNull: boolean; }; end_at: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; start_date: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; payment_details: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; metadata: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; created_at: { type: DataTypes.DateDataTypeConstructor; defaultValue: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; updated_at: { type: DataTypes.DateDataTypeConstructor; defaultValue: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; }; static initialize(sequelize: any): void; static associate(models: any): void; isImmutable(): boolean; isActive(): boolean; isScheduledToCancel(): boolean; isConsumesCredit(): Promise; start(): Promise; static getSummary(livemode?: boolean, field?: string): Promise; static getToSubscriptions(subscriptionId: string): Promise; static getFromSubscriptions(subscriptionId: string): Promise; } export type TSubscription = InferAttributes; export declare function getSubscriptionEventType(current: TSubscription, previous: Partial): "" | "paused" | "resumed";