import type { DocBlock } from '../docs/types';
import type { OwnerShipMeta } from '../ownership';
export type TelemetryPrivacyLevel = 'public' | 'internal' | 'pii' | 'sensitive';
export type TelemetryMeta = OwnerShipMeta;
export interface TelemetryPropertyDef {
    type: 'string' | 'number' | 'boolean' | 'timestamp' | 'json';
    required?: boolean;
    pii?: boolean;
    redact?: boolean;
    description?: string;
}
export interface TelemetryAnomalyThreshold {
    metric: string;
    min?: number;
    max?: number;
}
export type TelemetryAnomalyAction = 'alert' | 'log' | 'trigger_regen';
export interface TelemetryAnomalyDetectionConfig {
    enabled: boolean;
    thresholds?: TelemetryAnomalyThreshold[];
    actions?: TelemetryAnomalyAction[];
    /**
     * Minimum sample size before evaluating thresholds.
     * Helps avoid false positives on small sample sizes.
     */
    minimumSample?: number;
}
export interface TelemetrySamplingConfig {
    rate: number;
    conditions?: string[];
}
export interface TelemetryRetentionConfig {
    days: number;
    policy?: 'archive' | 'delete';
}
export interface TelemetryEventDef {
    /** Name of the event (should match EventSpec.key for cross-reference). */
    key: string;
    /** Version of the underlying event. */
    version: string;
    /** High-level semantics for docs/analyzers. */
    semantics: {
        who?: string;
        what: string;
        why?: string;
    };
    /** Detailed property metadata keyed by property name. */
    properties: Record<string, TelemetryPropertyDef>;
    /** Privacy level for the entire event. */
    privacy: TelemetryPrivacyLevel;
    /** Retention policy overrides. */
    retention?: TelemetryRetentionConfig;
    /** Sampling rules, defaulting to spec.config defaults. */
    sampling?: TelemetrySamplingConfig;
    /** Anomaly detection overrides. */
    anomalyDetection?: TelemetryAnomalyDetectionConfig;
    /** Optional tags for analytics/AI hints. */
    tags?: string[];
}
export interface TelemetryProviderConfig {
    type: 'posthog' | 'segment' | 'opentelemetry' | 'internal';
    config: Record<string, unknown>;
}
export interface TelemetryConfig {
    defaultRetentionDays?: number;
    defaultSamplingRate?: number;
    providers?: TelemetryProviderConfig[];
    anomalyDetection?: {
        enabled: boolean;
        checkIntervalMs?: number;
    };
}
export interface TelemetrySpec {
    meta: TelemetryMeta;
    events: TelemetryEventDef[];
    config?: TelemetryConfig;
}
import { SpecContractRegistry } from '../registry';
export declare class TelemetryRegistry extends SpecContractRegistry<'telemetry', TelemetrySpec> {
    private readonly eventsByKey;
    private readonly specByEventKey;
    constructor(items?: TelemetrySpec[]);
    register(spec: TelemetrySpec): this;
    private indexEvents;
    findEventDef(name: string, version?: string): TelemetryEventDef | undefined;
    getSpecForEvent(name: string, version: string): TelemetrySpec | undefined;
}
export declare function makeTelemetryKey(meta: TelemetryMeta): string;
export declare const tech_contracts_telemetry_DocBlocks: DocBlock[];
