export type DiagnosticSeverity = 'debug' | 'info' | 'warn' | 'error';
export type DiagnosticCategory = 'session' | 'resource' | 'playback' | 'runtime' | 'recovery' | 'ui-trigger';
export interface DiagnosticsConfig {
    enabled?: boolean;
    persist?: boolean;
    storageQuotaMb?: number;
    maxSessions?: number;
    maxHotEvents?: number;
    includeFullSourceUrl?: boolean;
    enablePanel?: boolean;
    consoleSeverityThreshold?: DiagnosticSeverity;
}
export interface DiagnosticMediaError {
    code: number | null;
    message: string | null;
}
export interface DiagnosticMediaState {
    currentTime: number | null;
    duration: number | null;
    readyState: number | null;
    networkState: number | null;
    paused: boolean | null;
    ended: boolean | null;
    playbackRate: number | null;
    currentSrc: string | null;
    bufferedEnd: number | null;
    videoWidth: number | null;
    videoHeight: number | null;
    error: DiagnosticMediaError | null;
    [key: string]: unknown;
}
export interface DiagnosticRuntimeState {
    currentTimeMs?: number;
    playState?: string;
    speed?: number;
    pendingMode?: 'seek' | 'scrub' | null;
    loadingCount?: number;
    isBuffering?: boolean;
    runtimePhase?: string;
    selectedClipId?: string | null;
    activeClipIds?: string[];
    previewAspectRatio?: {
        mode: string;
        width: number;
        height: number;
    } | null;
    [key: string]: unknown;
}
export interface DiagnosticErrorPayload {
    name: string | null;
    message: string | null;
    stack: string | null;
    cause: unknown;
}
export interface DiagnosticHardwareInfo {
    platform: string | null;
    hardwareConcurrency: number | null;
    deviceMemory: number | null;
    maxTouchPoints: number | null;
    language: string | null;
    languages: string[] | null;
}
export interface DiagnosticNetworkInfo {
    online: boolean | null;
    effectiveType: string | null;
    downlinkMbps: number | null;
    rttMs: number | null;
    saveData: boolean | null;
    connectionType: string | null;
}
export interface DiagnosticEvent {
    eventId: string;
    sessionId: string;
    sequence: number;
    timestamp: number;
    isoTime: string;
    perfTimeMs: number | null;
    severity: DiagnosticSeverity;
    category: DiagnosticCategory;
    eventName: string;
    message: string | null;
    syncRequestId: number | null;
    playbackAttemptId: string | null;
    previewBackend: string | null;
    trackId: string | null;
    clipId: string | null;
    slotKey: string | null;
    sourceUrl: string | null;
    desiredSourceUrl: string | null;
    actualSourceUrl: string | null;
    mediaState: DiagnosticMediaState | null;
    runtimeState: DiagnosticRuntimeState | null;
    error: DiagnosticErrorPayload | null;
    extra: Record<string, unknown> | null;
}
export interface DiagnosticSessionMetadata {
    packageName?: string | null;
    packageVersion?: string | null;
    userAgent?: string | null;
    href?: string | null;
    configuredPreviewBackend?: string | null;
    hardware?: DiagnosticHardwareInfo | null;
    network?: DiagnosticNetworkInfo | null;
    environmentCapturedAt?: string | null;
    environmentExportedAt?: string | null;
    [key: string]: unknown;
}
export interface DiagnosticSessionSummary {
    totalEvents: number;
    severityCounts: Record<DiagnosticSeverity, number>;
    categoryCounts: Record<DiagnosticCategory, number>;
    failureCount: number;
    lastFailureEvent: Pick<DiagnosticEvent, 'eventId' | 'eventName' | 'timestamp' | 'isoTime' | 'message' | 'trackId' | 'clipId' | 'syncRequestId' | 'playbackAttemptId'> | null;
}
export interface DiagnosticSessionSnapshot {
    sessionId: string;
    startedAt: number;
    updatedAt: number;
    metadata: DiagnosticSessionMetadata | null;
    events: DiagnosticEvent[];
    summary: DiagnosticSessionSummary;
}
export interface DiagnosticLiveEvent {
    sequence: number;
    timestamp: number;
    isoTime: string;
    severity: DiagnosticSeverity;
    category: DiagnosticCategory;
    eventName: string;
    message: string | null;
    syncRequestId: number | null;
    playbackAttemptId: string | null;
    trackId: string | null;
    clipId: string | null;
    extra: Record<string, unknown> | null;
    error: DiagnosticErrorPayload | null;
}
export interface DiagnosticLiveSnapshot {
    sessionId: string;
    startedAt: number;
    updatedAt: number;
    metadata: DiagnosticSessionMetadata | null;
    summary: DiagnosticSessionSummary;
    recentEvents: DiagnosticLiveEvent[];
}
export interface DiagnosticExportPackage {
    exportedAt: string;
    session: Omit<DiagnosticSessionSnapshot, 'events'>;
    rawEvents: DiagnosticEvent[];
    failureWindow: DiagnosticEvent[];
    failureWindowSource: 'live' | 'persisted' | 'recent-events';
}
export interface DiagnosticEmitInput {
    severity: DiagnosticSeverity;
    category: DiagnosticCategory;
    eventName: string;
    message?: string | null;
    syncRequestId?: number | null;
    playbackAttemptId?: string | null;
    previewBackend?: string | null;
    trackId?: string | null;
    clipId?: string | null;
    slotKey?: string | null;
    sourceUrl?: string | null;
    desiredSourceUrl?: string | null;
    actualSourceUrl?: string | null;
    mediaState?: DiagnosticMediaState | null;
    runtimeState?: DiagnosticRuntimeState | null;
    error?: unknown;
    extra?: Record<string, unknown> | null;
}
export type DiagnosticsListener = (snapshot: DiagnosticSessionSnapshot) => void;
export type DiagnosticsLiveListener = (snapshot: DiagnosticLiveSnapshot) => void;
