import { ICollectionAuditedEntity, ICollectionMoney } from './Common'; import { IPaymentPlanConfigurationSnapshot, PaymentPlanFrequency } from './PaymentPlanConfiguration'; export declare enum PaymentPlanStatus { DRAFT = "DRAFT", PENDING_APPROVAL = "PENDING_APPROVAL", ACTIVE = "ACTIVE", COMPLETED = "COMPLETED", FAILED = "FAILED", CANCELLED = "CANCELLED", REFINANCED = "REFINANCED" } export declare enum PaymentPlanInstallmentStatus { PENDING = "PENDING", PARTIALLY_PAID = "PARTIALLY_PAID", PAID = "PAID", OVERDUE = "OVERDUE", CANCELLED = "CANCELLED" } export interface IPlannedDebtAllocation { debtId: string; principal: ICollectionMoney; interest?: ICollectionMoney; fees?: ICollectionMoney; taxes?: ICollectionMoney; discounts?: ICollectionMoney; total: ICollectionMoney; } export interface IPaymentPlanInstallment { id: string; number: number; dueAt: Date; amount: ICollectionMoney; paidAmount: ICollectionMoney; status: PaymentPlanInstallmentStatus; allocations?: IPlannedDebtAllocation[]; } export interface IPaymentPlan extends ICollectionAuditedEntity { portfolioId: string; contactId: string; debtIds: string[]; status: PaymentPlanStatus; configurationId?: string; configurationVersion?: number; /** Immutable copy of every value and formula used to calculate this plan. */ configurationSnapshot?: IPaymentPlanConfigurationSnapshot; totalAmount: ICollectionMoney; downPayment?: ICollectionMoney; interestConfigurationId?: string; installments: IPaymentPlanInstallment[]; activatedAt?: Date; completedAt?: Date; failedAt?: Date; failureReason?: string; failurePolicyId?: string; replacesPlanId?: string; replacedByPlanId?: string; approvedAt?: Date; approvedBy?: string; version: number; } export interface IPaymentPlanFailurePolicy extends ICollectionAuditedEntity { name: string; enabled: boolean; maximumOverdueInstallments?: number; gracePeriodDays?: number; minimumOverdueAmount?: ICollectionMoney; automaticFailure: boolean; supervisorApprovalRequired: boolean; } export interface ICreatePaymentPlanDto { portfolioId: string; contactId: string; debtIds: string[]; configurationId?: string; installmentCount?: number; firstDueAt?: Date; frequency?: PaymentPlanFrequency; customDueDates?: Date[]; totalAmount: ICollectionMoney; downPayment?: ICollectionMoney; interestConfigurationId?: string; /** Optional for formula-generated plans; required for manually constructed plans. */ installments?: Omit[]; replacesPlanId?: string; source?: string; idempotencyKey?: string; }