/**
 * Diminishing Returns for Trust Signals
 *
 * Prevents gaming by reducing the impact of repeated same-type signals.
 * Each subsequent signal of the same type/source within a window has
 * progressively reduced weight.
 *
 * @packageDocumentation
 */
import type { TrustSignal as TrustSignalType } from '../common/types.js';
/**
 * Diminishing returns configuration
 */
export interface DiminishingReturnsConfig {
    /** Time window in milliseconds for tracking repeated signals (default: 7 days) */
    windowMs: number;
    /** Weight factors for 1st, 2nd, 3rd, 4th+ signals of same type */
    diminishingFactors: [number, number, number, number];
    /** Whether to track by source in addition to type */
    trackBySource: boolean;
}
/**
 * Default configuration
 *
 * - 7-day window for tracking repeats
 * - 1st signal: 100%, 2nd: 70%, 3rd: 50%, 4th+: 30%
 * - Track by type+source combination
 */
export declare const DEFAULT_DIMINISHING_CONFIG: DiminishingReturnsConfig;
/**
 * Tracks frequency of signal types within a window
 */
export interface SignalFrequencyMap {
    /** Map of signal key to count within window */
    counts: Map<string, number>;
    /** Signals included in this frequency map */
    signalIds: Set<string>;
}
/**
 * Build a signal key for frequency tracking
 *
 * @param signal - The signal to key
 * @param trackBySource - Whether to include source in key
 */
export declare function buildSignalKey(signal: TrustSignalType, trackBySource: boolean): string;
/**
 * Build frequency map from signals within time window
 *
 * @param signals - All signals to analyze (should be sorted by timestamp desc)
 * @param config - Diminishing returns configuration
 * @returns Frequency map with counts per signal type/source
 */
export declare function buildFrequencyMap(signals: TrustSignalType[], config?: DiminishingReturnsConfig): SignalFrequencyMap;
/**
 * Get the occurrence number for a signal (1st, 2nd, 3rd, etc. of its type)
 *
 * This counts how many signals of the same type occurred BEFORE this one
 * within the window, to determine this signal's position.
 *
 * @param signal - The signal to check
 * @param allSignals - All signals sorted by timestamp descending
 * @param config - Diminishing returns configuration
 * @returns 1-based occurrence number (1 = first of type, 2 = second, etc.)
 */
export declare function getSignalOccurrence(signal: TrustSignalType, allSignals: TrustSignalType[], config?: DiminishingReturnsConfig): number;
/**
 * Calculate diminished weight for a signal based on its occurrence
 *
 * @param occurrence - 1-based occurrence number (1 = first, 2 = second, etc.)
 * @param baseWeight - Original signal weight
 * @param config - Diminishing returns configuration
 * @returns Adjusted weight after diminishing returns
 */
export declare function calculateDiminishedWeight(occurrence: number, baseWeight: number, config?: DiminishingReturnsConfig): number;
/**
 * Apply diminishing returns to a signal's weight
 *
 * Combines occurrence-based diminishing with the signal's base weight.
 *
 * @param signal - The signal to adjust
 * @param allSignals - All signals for context (sorted by timestamp desc)
 * @param config - Diminishing returns configuration
 * @returns Adjusted weight
 */
export declare function applyDiminishingReturns(signal: TrustSignalType, allSignals: TrustSignalType[], config?: DiminishingReturnsConfig): number;
/**
 * Result of applying diminishing returns to signals
 */
export interface DiminishedSignalsResult {
    /** Signals with adjusted weights */
    signals: Array<TrustSignalType & {
        diminishedWeight: number;
        occurrence: number;
    }>;
    /** Summary statistics */
    stats: {
        totalSignals: number;
        uniqueTypes: number;
        avgDiminishment: number;
        mostRepeatedType: string | null;
        mostRepeatedCount: number;
    };
}
/**
 * Apply diminishing returns to all signals and return adjusted weights
 *
 * @param signals - Signals to process (will be sorted internally)
 * @param config - Diminishing returns configuration
 * @returns Signals with diminished weights and statistics
 */
export declare function processSignalsWithDiminishing(signals: TrustSignalType[], config?: DiminishingReturnsConfig): DiminishedSignalsResult;
/**
 * Calculate weighted average with diminishing returns applied
 *
 * This is the primary function to use in TrustEngine.averageSignalValue
 *
 * @param signals - Signals to average
 * @param defaultValue - Default if no signals
 * @param config - Diminishing returns configuration
 * @returns Weighted average with diminishing returns applied
 */
export declare function averageWithDiminishing(signals: TrustSignalType[], defaultValue: number, config?: DiminishingReturnsConfig): number;
//# sourceMappingURL=diminishing-returns.d.ts.map