import { ReactNode } from "react";
import { ItemTreeNodeData } from "../services/contentService";
import { EditContextType } from "../client/editContext";
/**
 * Severity levels for indicators, used for styling.
 */
export type IndicatorSeverity = "error" | "warning" | "info" | "success" | "neutral";
/**
 * Provider metadata from the backend.
 */
export interface IndicatorProviderInfo {
    id: string;
    label: string;
    icon: string;
    priority: number;
}
/**
 * Indicator data for a single item from a single provider.
 */
export interface IndicatorData {
    severity?: IndicatorSeverity;
    tooltip?: string;
    customIcon?: string;
    /** Optional count to display as a badge on the icon (e.g., number of comments, users) */
    count?: number;
}
export type ContentTreeIndicatorActionContext = {
    provider: IndicatorProviderInfo;
    indicator: IndicatorData;
    itemId: string;
    itemLanguage: string;
};
export type ContentTreeIndicatorActionDefinition = {
    onClick: (editContext: EditContextType, context: ContentTreeIndicatorActionContext) => Promise<void> | void;
    ariaLabel?: string | ((context: ContentTreeIndicatorActionContext) => string);
    isEnabled?: (editContext: EditContextType, context: ContentTreeIndicatorActionContext) => boolean;
};
/**
 * A single indicator instance for display in a node.
 */
export interface NodeIndicator {
    id: string;
    icon: ReactNode;
    tooltip?: string;
    severity?: IndicatorSeverity;
    onClick?: () => void;
}
/**
 * Frontend provider interface - each provider represents one gutter column type.
 */
export interface IndicatorProvider {
    /** Unique ID (e.g., "validation", "activity") */
    id: string;
    /** Display name in selector */
    label: string;
    /** Icon shown in the tree settings menu */
    icon: ReactNode;
    /** Column order (lower = further left) */
    priority: number;
    /** Sync: compute from existing node data */
    getIndicator?: (node: ItemTreeNodeData, ctx: EditContextType) => NodeIndicator | null;
    /** Async: batch fetch for multiple nodes (results cached) */
    getIndicatorsAsync?: (nodeIds: string[], ctx: EditContextType) => Promise<Map<string, NodeIndicator | null>>;
}
/**
 * User preferences for gutter visibility.
 */
export interface GutterPreferences {
    visibleGutters: string[];
}
/**
 * Map of indicator data: { [itemId]: { [providerId]: IndicatorData } }
 */
export type IndicatorMap = Record<string, Record<string, IndicatorData>>;
/**
 * NDJSON chunk types from the streaming API.
 */
export type IndicatorChunk = {
    type: "providers";
    data: IndicatorProviderInfo[];
} | {
    type: "indicator";
    providerId: string;
    itemId: string;
    data: IndicatorData;
} | {
    type: "complete";
} | {
    type: "error";
    message: string;
};
/**
 * Logical trigger names used by the frontend dependency map
 * to resolve which providers should be refreshed.
 */
export type IndicatorDependencyTrigger = "active-sessions" | "comment-updated" | "comment-deleted" | "suggested-edit-updated" | "suggested-edit-deleted" | "item-changed" | "language-version-changed" | "manual-refresh";
