import { D as DecisionPoint, A as AdapterConfig, F as FraudDb, a as FraudSignal, b as FraudAdapter, c as FraudAction, P as PipelineResult, S as SignupCtx, E as EarnCtx, C as ClickCtx } from '../types-CzYmxGUQ.js';
export { d as FraudHostStore, L as LinkConversionStats, e as PhoneBlindIndexRow, f as StoredDecisionPoint, U as UserIdentityRingFields, W as WithdrawCtx, t as toStoredDecisionPoint } from '../types-CzYmxGUQ.js';
import '@platform-modules/db';

/** Resolve MAX-severity across all signals. */
declare function resolveAction(signals: FraudSignal[]): FraudAction;
/** Downgrade signal action to at most cfg.action if specified. */
declare function applyDowngrade(signal: FraudSignal, cfg: AdapterConfig): FraudSignal;
declare function registerAdapter(adapter: FraudAdapter<any>): void;
/** Test-only: clear the in-memory adapter registry between cases. */
declare function resetAdaptersForTest(): void;
declare function getAdaptersForPoint(point: DecisionPoint): FraudAdapter<unknown>[];
interface RunPipelineInput<Ctx> {
    point: DecisionPoint;
    ctx: Ctx;
    userId: string;
    referralId?: string;
    fraudConfig: Record<string, AdapterConfig>;
    db: FraudDb;
    /** If false, skip fraud_events insert (e.g. CLICK → AE-only). */
    persistEvents?: boolean;
}
declare function runFraudPipeline<Ctx>(input: RunPipelineInput<Ctx>): Promise<PipelineResult>;

interface InsertFraudEventInput {
    userId: string;
    referralId?: string;
    decisionPoint: DecisionPoint;
    signal: FraudSignal;
}
declare function insertFraudEvent(db: FraudDb, input: InsertFraudEventInput): Promise<string | null>;

declare function registerFraudAdapters(): void;
/** Test-only: allow re-registration in isolated test files. */
declare function resetFraudAdapterRegistrationForTest(): void;

/**
 * Canonicalize an email address for identity deduplication.
 *
 * Gmail / Googlemail rules:
 *   - dots in local-part are ignored (j.o.h.n == john)
 *   - plus-suffix is stripped (john+spam@gmail.com == john@gmail.com)
 *   - googlemail.com is an alias for gmail.com
 *
 * All other providers: lowercase only.
 */
declare function canonicalizeEmail(raw: string): string;

declare const emailCanonicalAdapter: FraudAdapter<SignupCtx>;

declare const emailDisposableAdapter: FraudAdapter<SignupCtx>;

/**
 * Twilio Lookup behind env var gate.
 * Default OFF (enabled:false in default config).
 * Requires TWILIO_ACCOUNT_SID + TWILIO_AUTH_TOKEN in env.
 */
declare const phoneLinetypeAdapter: FraudAdapter<SignupCtx | EarnCtx>;

declare const phoneRequiredEarnAdapter: FraudAdapter<EarnCtx>;

declare const identityRingAdapter: FraudAdapter<EarnCtx>;

/**
 * Flag when:
 *   1. Domain is NOT a known major provider.
 *   2. Domain appears for the Nth new user in a rolling window (cfg.params.clusterThreshold).
 * Relies on a simple DB count; no external DNS call (avoids latency in hot path).
 */
declare const emailCatchallDomainAdapter: FraudAdapter<SignupCtx>;

/**
 * CF bot score from request context.
 * cfBotScore: 0..99 (Cloudflare), lower = more likely bot.
 * Default threshold: score <= 30 → flag.
 */
declare const botSignupAdapter: FraudAdapter<SignupCtx>;

declare const deviceFingerprintAdapter: FraudAdapter<EarnCtx | SignupCtx>;

declare const ipClusterAdapter: FraudAdapter<EarnCtx | SignupCtx>;

/**
 * IP reputation via pluggable provider interface.
 * Default: CF bot signals (cfBotScore on SignupCtx); no paid vendor by default.
 * CLICK point: uses existing ipHash only (no external call — AE-only logging).
 */
declare const ipReputationAdapter: FraudAdapter<ClickCtx | SignupCtx>;

declare const paymentInstrumentAdapter: FraudAdapter<EarnCtx>;

declare const velocityConversionAdapter: FraudAdapter<EarnCtx>;

/**
 * Referral-graph adapter: invoked by the reconciliation cron scan (§7), not the hot path.
 * At EARN it is a no-op (graph scan happens nightly — see runReferralGraphScan).
 */
declare const referralGraphAdapter: FraudAdapter<EarnCtx>;

export { AdapterConfig, ClickCtx, DecisionPoint, EarnCtx, FraudAction, FraudAdapter, FraudDb, FraudSignal, type InsertFraudEventInput, PipelineResult, type RunPipelineInput, SignupCtx, applyDowngrade, botSignupAdapter, canonicalizeEmail, deviceFingerprintAdapter, emailCanonicalAdapter, emailCatchallDomainAdapter, emailDisposableAdapter, getAdaptersForPoint, identityRingAdapter, insertFraudEvent, ipClusterAdapter, ipReputationAdapter, paymentInstrumentAdapter, phoneLinetypeAdapter, phoneRequiredEarnAdapter, referralGraphAdapter, registerAdapter, registerFraudAdapters, resetAdaptersForTest, resetFraudAdapterRegistrationForTest, resolveAction, runFraudPipeline, velocityConversionAdapter };
