import { SmrtCollection } from '@happyvertical/smrt-core'; import { ReferralAgreement } from '../models/ReferralAgreement.js'; import { ReferralAgreementApprovalMode } from '../types.js'; /** * Fields an amendment may change relative to the version it copies. * `referrerId`/`programId` are fixed (they identify the agreement), * `version` is computed, and `status` is always `draft`. */ export interface ReferralAgreementAmendmentChanges { commissionPlanKey?: string; commissionPlanVersion?: number; clearingDays?: number; approvalMode?: ReferralAgreementApprovalMode; effectiveFrom?: Date | null; effectiveTo?: Date | null; metadata?: Record; } export declare class ReferralAgreementCollection extends SmrtCollection { static readonly _itemClass: typeof ReferralAgreement; /** Every version of one referrer+program agreement, newest version first. */ findByReferrerAndProgram(referrerId: string, programId: string): Promise; /** * The agreement governing `(referrerId, programId)` at instant `at` * (default now): status `active` AND effective window containing `at` * (`effectiveFrom` null = always started; `effectiveTo` null = * open-ended). When several active versions overlap — transitional states * during amendment activation — the highest version wins. `null` when * nothing governs. */ activeFor(referrerId: string, programId: string, at?: Date): Promise; /** * Create an amendment: insert a new DRAFT row with * `version = max(existing versions) + 1`, copying the latest existing * version's fields and then applying `changes`. The source version is not * touched — activate the draft (and supersede the prior active version) * as a separate, explicit step. * * Throws when no version exists for the pair (nothing to amend — use * `create` for a brand-new agreement). */ createAmendment(referrerId: string, programId: string, changes?: ReferralAgreementAmendmentChanges): Promise; } export default ReferralAgreementCollection; //# sourceMappingURL=ReferralAgreementCollection.d.ts.map