import { SmrtObject } from '@happyvertical/smrt-core'; import { ReferrerOptions, ReferrerStatus } from '../types.js'; /** * Referrer is a ROLE model: it links an identity (smrt-profiles Profile) to * referral activity (ReferralLinks, ReferralTouches, and Referrals reference * `referrerId`). * * Roles and money stay separate (see `packages/sales/AGENTS.md` "Roles vs. * money"): a referrer connects to payouts only through the optional * `earnerId` pointing at the commissions module's neutral `Earner`. A * referral cannot produce Commissions until its referrer carries an * `earnerId` — `ReferralCommissionService` skips such referrals with reason * `'referrer_missing_earner'`. * * @example * ```typescript * const referrers = await ReferrerCollection.create({ db }); * const referrer = await referrers.create({ * profileId: 'profile-uuid', * displayName: 'Jordan Partner', * status: 'active', * }); * const active = await referrers.findActive(); * ``` */ export declare class Referrer extends SmrtObject { /** * Tenant ID for multi-tenant isolation. Nullable to support both * tenant-scoped and global (operator-level) referrers. */ tenantId: string | null; /** * Identity of the person/organization acting as a referrer — * cross-package string reference to a smrt-profiles Profile. */ profileId: string; /** * Optional link to the commissions module's `Earner` (the neutral payout * identity). String-form same-package FK: the Earner class lives in * `src/commissions` and is intentionally NOT imported here — the string * form registers the relationship without a module dependency, keeping the * `referrals → commissions` boundary reference-only at the model layer. * Empty when the referrer is not commission-compensated (yet). */ earnerId: string; /** Human-readable display name for portals and operator views. */ displayName: string; /** * Role lifecycle: `pending` (default, awaiting approval) → `active` / * `suspended`. Only active referrers should receive new links/agreements. */ status: ReferrerStatus; /** * Free-form JSON object stored as a string. Use * {@link getMetadata}/{@link setMetadata} instead of parsing manually. */ metadata: string; constructor(options?: ReferrerOptions); /** Whether the referrer may receive new links/agreements. */ isActive(): boolean; isPending(): boolean; isSuspended(): boolean; /** Parse the metadata JSON string; returns `{}` on malformed content. */ getMetadata(): Record; /** Serialize and store the metadata object. */ setMetadata(metadata: Record): void; } export default Referrer; //# sourceMappingURL=Referrer.d.ts.map