import { SmrtObjectOptions } from '@happyvertical/smrt-core'; /** Lifecycle of a {@link ReferrerOptions | Referrer} role. */ export declare const REFERRER_STATUSES: readonly ["pending", "active", "suspended"]; export type ReferrerStatus = (typeof REFERRER_STATUSES)[number]; /** Lifecycle of a {@link ReferralProgramOptions | ReferralProgram}. */ export declare const REFERRAL_PROGRAM_STATUSES: readonly ["draft", "active", "paused", "archived"]; export type ReferralProgramStatus = (typeof REFERRAL_PROGRAM_STATUSES)[number]; /** * Lifecycle of a versioned AttributionPolicy row. * * `draft → active | retired`; `active → superseded | retired`; * `superseded` / `retired` are terminal. Amendments never mutate an active * row — they insert a new `(policyKey, version + 1)` draft (CommissionPlan * pattern). */ export declare const ATTRIBUTION_POLICY_STATUSES: readonly ["draft", "active", "superseded", "retired"]; export type AttributionPolicyStatus = (typeof ATTRIBUTION_POLICY_STATUSES)[number]; /** * How an AttributionPolicy credits touches: * * - `first_touch` — the earliest eligible touch wins. * - `last_touch` — the latest eligible touch wins. * - `assigned` — only `manual_assignment` touches count (most recent wins; * competing assignments from distinct referrers raise an exception). * - `split` — every distinct eligible referrer receives an attributed * Referral with an equal credit fraction sharing one `splitGroupId`. */ export declare const ATTRIBUTION_CREDIT_MODES: readonly ["first_touch", "last_touch", "assigned", "split"]; export type AttributionCreditMode = (typeof ATTRIBUTION_CREDIT_MODES)[number]; /** * How an AttributionPolicy behaves when more than one distinct eligible * referrer competes: `auto` lets the credit mode decide (only genuine * conflicts raise exceptions); `review` forces an AttributionException for * any multi-referrer contention. */ export declare const ATTRIBUTION_CONFLICT_BEHAVIORS: readonly ["auto", "review"]; export type AttributionConflictBehavior = (typeof ATTRIBUTION_CONFLICT_BEHAVIORS)[number]; /** Lifecycle of a ReferralLink — disabled links refuse new clicks. */ export declare const REFERRAL_LINK_STATUSES: readonly ["active", "disabled"]; export type ReferralLinkStatus = (typeof REFERRAL_LINK_STATUSES)[number]; /** Kinds of immutable ReferralTouch attribution evidence. */ export declare const REFERRAL_TOUCH_KINDS: readonly ["click", "code_entry", "manual_assignment", "partner_entry"]; export type ReferralTouchKind = (typeof REFERRAL_TOUCH_KINDS)[number]; /** * Lifecycle of a Referral. Guarded transitions (save-time, authoritative * prior re-read — commerce pattern): * `pending → attributed | under_review | disqualified | expired`; * `under_review → attributed | disqualified`; * `attributed → qualified | disqualified | expired`; * `qualified → disqualified` (rare clawback path); * `disqualified` / `expired` are terminal. */ export declare const REFERRAL_STATUSES: readonly ["pending", "attributed", "qualified", "disqualified", "expired", "under_review"]; export type ReferralStatus = (typeof REFERRAL_STATUSES)[number]; /** Lifecycle of an AttributionException conflict-review row. */ export declare const ATTRIBUTION_EXCEPTION_STATUSES: readonly ["open", "resolved"]; export type AttributionExceptionStatus = (typeof ATTRIBUTION_EXCEPTION_STATUSES)[number]; /** * How an AttributionException was resolved: `override` (a human awarded * credit explicitly) or `policy` (a policy re-run settled it). Stored as an * open string on the model; this list is the recommended vocabulary. */ export declare const ATTRIBUTION_RESOLUTION_MODES: readonly ["override", "policy"]; export type AttributionResolutionMode = (typeof ATTRIBUTION_RESOLUTION_MODES)[number]; /** * Lifecycle of a versioned ReferralAgreement row. * * `draft → active | terminated`; `active → superseded | terminated`; * `superseded` / `terminated` are terminal. */ export declare const REFERRAL_AGREEMENT_STATUSES: readonly ["draft", "active", "superseded", "terminated"]; export type ReferralAgreementStatus = (typeof REFERRAL_AGREEMENT_STATUSES)[number]; /** * How commissions earned under an agreement are approved downstream: * `manual` (an operator approves each earning) or `auto`. Recorded on the * agreement and frozen into every ReferralTermSnapshot. */ export declare const REFERRAL_AGREEMENT_APPROVAL_MODES: readonly ["manual", "auto"]; export type ReferralAgreementApprovalMode = (typeof REFERRAL_AGREEMENT_APPROVAL_MODES)[number]; /** * One competing touch recorded in an AttributionException's `candidates` * JSON array — enough to review the conflict without re-querying touches. */ export interface AttributionExceptionCandidate { /** Id of the candidate ReferralTouch (empty for touchless awards). */ touchId: string; /** The referrer the touch credits. */ referrerId: string; /** Kind of the candidate touch. */ kind: ReferralTouchKind; /** ISO-8601 timestamp of when the candidate touch occurred. */ occurredAt: string; } /** Options for constructing a Referrer. */ export interface ReferrerOptions extends SmrtObjectOptions { tenantId?: string | null; profileId?: string; earnerId?: string; displayName?: string; status?: ReferrerStatus; metadata?: string; } /** Options for constructing a ReferralProgram. */ export interface ReferralProgramOptions extends SmrtObjectOptions { tenantId?: string | null; key?: string; name?: string; status?: ReferralProgramStatus; defaultCommissionPlanKey?: string; defaultAttributionPolicyKey?: string; metadata?: string; } /** Options for constructing an AttributionPolicy. */ export interface AttributionPolicyOptions extends SmrtObjectOptions { tenantId?: string | null; policyKey?: string; version?: number; status?: AttributionPolicyStatus; effectiveFrom?: Date | string | number | null; windowDays?: number; creditMode?: AttributionCreditMode; conflictBehavior?: AttributionConflictBehavior; allowSelfReferral?: boolean; allowExistingClients?: boolean; eligibleServices?: string; eligibleCampaigns?: string; eligibleRegions?: string; metadata?: string; } /** Options for constructing a ReferralLink. */ export interface ReferralLinkOptions extends SmrtObjectOptions { tenantId?: string | null; referrerId?: string; programId?: string; code?: string; targetUrl?: string; label?: string; status?: ReferralLinkStatus; clickCount?: number; metadata?: string; } /** Options for constructing a ReferralTouch. */ export interface ReferralTouchOptions extends SmrtObjectOptions { tenantId?: string | null; linkId?: string; code?: string; referrerId?: string; programId?: string; kind?: ReferralTouchKind; subjectKind?: string; subjectId?: string; occurredAt?: Date | string | number; evidence?: string; metadata?: string; } /** Options for constructing a Referral. */ export interface ReferralOptions extends SmrtObjectOptions { tenantId?: string | null; referrerId?: string; programId?: string; policyKey?: string; policyVersion?: number; status?: ReferralStatus; targetKind?: string; targetId?: string; creditFraction?: number; splitGroupId?: string; primaryTouchId?: string; attributedAt?: Date | string | number | null; qualifiedAt?: Date | string | number | null; expiresAt?: Date | string | number | null; snapshotId?: string; metadata?: string; } /** Options for constructing an AttributionException. */ export interface AttributionExceptionOptions extends SmrtObjectOptions { tenantId?: string | null; targetKind?: string; targetId?: string; programId?: string; status?: AttributionExceptionStatus; conflictReason?: string; candidates?: string; resolutionMode?: string; resolutionReason?: string; resolvedByProfileId?: string; resolvedReferralIds?: string; resolvedAt?: Date | string | number | null; metadata?: string; } /** Options for constructing a ReferralAgreement. */ export interface ReferralAgreementOptions extends SmrtObjectOptions { tenantId?: string | null; referrerId?: string; programId?: string; version?: number; status?: ReferralAgreementStatus; effectiveFrom?: Date | string | number | null; effectiveTo?: Date | string | number | null; commissionPlanKey?: string; commissionPlanVersion?: number; clearingDays?: number; approvalMode?: ReferralAgreementApprovalMode; executionId?: string | null; executedAgreementId?: string | null; metadata?: string; } /** Options for constructing a ReferralTermSnapshot. */ export interface ReferralTermSnapshotOptions extends SmrtObjectOptions { tenantId?: string | null; referralId?: string; agreementId?: string; agreementVersion?: number; planKey?: string; planVersion?: number; policyKey?: string; policyVersion?: number; components?: string; currency?: string; clearingDays?: number; approvalMode?: ReferralAgreementApprovalMode; metadata?: string; } //# sourceMappingURL=types.d.ts.map