import type { Datum } from "../../charts/shared/datumTypes";
/**
 * XYSceneContext — shared context passed to all XY scene builder functions.
 *
 * Mirrors the ordinal pattern (OrdinalSceneContext in ordinalSceneBuilders/).
 * Scene builders are pure functions that receive this context instead of
 * accessing PipelineStore instance fields directly.
 */
import type { StreamScales, Style, CurveType, BarStyle, ThemeSemanticColors } from "../types";
export interface XYSceneContext {
    scales: StreamScales;
    config: XYSceneConfig;
    getX: (d: Datum) => number;
    getY: (d: Datum) => number;
    getY0?: (d: Datum) => number | null;
    getSize?: (d: Datum) => number;
    getColor?: (d: Datum) => string;
    getGroup?: (d: Datum) => string;
    getCategory?: (d: Datum) => string;
    getPointId?: (d: Datum) => string;
    getBounds?: (d: Datum) => number | null;
    getOpen?: (d: Datum) => number;
    getHigh?: (d: Datum) => number;
    getLow?: (d: Datum) => number;
    getClose?: (d: Datum) => number;
    /** Style resolvers — delegate to PipelineStore's cached color management */
    resolveLineStyle: (group: string, sampleDatum?: Datum) => Style;
    resolveAreaStyle: (group: string, sampleDatum?: Datum) => Style;
    resolveBoundsStyle: (group: string, sampleDatum?: Datum) => Style;
    resolveColorMap: (data: Datum[]) => Map<string, string>;
    resolveGroupColor: (group: string) => string | null;
    /** Group data by lineBy/colorBy accessor */
    groupData: (data: Datum[]) => {
        key: string;
        data: Datum[];
    }[];
    /** Instance-scoped mutable cache for bar category ordering (prevents cross-instance leaks) */
    barCategoryCache?: {
        key: string;
        order: string[];
    } | null;
}
/** Subset of PipelineConfig fields that scene builders need */
export interface XYSceneConfig {
    chartType: string;
    curve?: CurveType;
    colorScheme?: string | string[];
    normalize?: boolean;
    gradientFill?: boolean | {
        topOpacity?: number;
        bottomOpacity?: number;
    } | {
        colorStops: Array<{
            offset: number;
            color: string;
        }>;
    };
    areaGroups?: Set<string>;
    lineGradient?: {
        colorStops: Array<{
            offset: number;
            color: string;
        }>;
    };
    annotations?: Datum[];
    pointStyle?: (d: Datum) => Style & {
        r?: number;
    };
    sizeRange?: [number, number];
    xAccessor?: string | ((d: Datum) => any);
    yAccessor?: string | ((d: Datum) => any);
    valueAccessor?: string | ((d: Datum) => any);
    heatmapAggregation?: "count" | "sum" | "mean";
    heatmapXBins?: number;
    heatmapYBins?: number;
    showValues?: boolean;
    heatmapValueFormat?: (v: number) => string;
    binSize?: number;
    barColors?: Record<string, string>;
    /** Bar fill/stroke/strokeWidth/gap. Threaded through from RealtimeHistogram. */
    barStyle?: BarStyle;
    themeSemantic?: ThemeSemanticColors;
    /** Theme sequential scheme name — fallback when colorScheme is not set (heatmap). */
    themeSequential?: string;
    /** Theme diverging scheme name — fallback when colorScheme is not set. */
    themeDiverging?: string;
    swarmStyle?: {
        radius?: number;
        fill?: string;
        opacity?: number;
        stroke?: string;
        strokeWidth?: number;
    };
    waterfallStyle?: {
        positiveColor?: string;
        negativeColor?: string;
        gap?: number;
        stroke?: string;
        strokeWidth?: number;
        opacity?: number;
        connectorStroke?: string;
        connectorWidth?: number;
    };
    candlestickStyle?: {
        upColor?: string;
        downColor?: string;
        wickColor?: string;
        wickWidth?: number;
        bodyWidth?: number;
        rangeColor?: string;
    };
    /** True when candlestick is in range/dumbbell mode (no open/close accessors provided) */
    candlestickRangeMode?: boolean;
    boundsStyle?: Style | ((d: any, group: string) => Style);
    lineStyle?: Style | ((d: any, group: string) => Style);
    areaStyle?: (d: Datum) => Style;
}
