import * as jsdom from 'jsdom';
import { JSDOM } from 'jsdom';

interface EnvironmentOptions {
    dashboardId: string;
    finebiServerUrl: string;
    inlineScripts?: string[];
    html?: string;
    baseUrl?: string;
}
/**
 * Set up a browser-like runtime for dashboard querying.
 */
declare function createBrowserEnvironment(options: EnvironmentOptions): Promise<{
    window: jsdom.DOMWindow;
    document: Document;
    dom: JSDOM;
    options: EnvironmentOptions;
}>;
/**
 * Initialize dashboard design configuration.
 */
declare function initDashboardDesignConfigure(dashboardId: string, serverUrl: string): Promise<{
    BI: {
        basePool: any;
        designConfigure: any;
        reportName: any;
        confPool: any;
        systemPool: any;
        sessionId: string;
        subjectId: string;
        theme: string;
        title: string;
        lockedBy: string;
    };
}>;
/**
 * Fetch dashboard custom pool data.
 */
declare function initDashboardCustomPoolEnv(dashboardId: string, serverUrl: string): Promise<any>;

interface QueryOptions {
    dashboardId: string;
    widgetId?: string;
    [key: string]: any;
}
interface WidgetDataOptions {
    compact?: boolean;
}
interface FilterOptions {
    widgetId?: string;
    widgetType?: number;
    filterValue?: any;
    fieldId?: string;
    value?: any;
    operator?: string;
}
interface LinkageTarget {
    widgetId: string;
    widgetType?: number;
    filterValue?: any;
    value?: any;
}
interface LinkageOptions {
    dId: string;
    fieldId: string;
    text: string | number;
    value?: {
        dId: string;
        fieldId: string;
        text: string;
    }[];
}
interface FineBIContext {
    window: any;
    document: any;
    dom: any;
    finebiServerUrl: string;
}

declare class QueryAPI {
    private context;
    private templateHelper;
    constructor(context: FineBIContext, templateHelper: any);
    /**
     * Query widget data.
     */
    getWidgetData(wId: string, options?: WidgetDataOptions): Promise<any>;
}

declare class FilterAPI {
    private context;
    private templateHelper;
    constructor(context: FineBIContext, templateHelper: any);
    /**
     * 应用过滤器
     */
    applyFilter(filters: FilterOptions | FilterOptions[]): Promise<boolean>;
}

declare class LinkageAPI {
    private context;
    private templateHelper;
    constructor(context: FineBIContext, templateHelper: any);
    private setWidgetValue;
    private uniqCrossCellClickedValue;
    private clearDrillSequence;
    /**
     * 应用联动结果到目标组件
     */
    applyLinkage(wId: string, linkage: LinkageOptions): Promise<boolean>;
    /**
     * 清除组件联动
     */
    cancelLinkage(wId: string): void;
    /**
     * 清空联动目标值
     */
    clearLinkage(widgetIds: string[]): Promise<boolean>;
}

declare class FineBIQueryDataSDK {
    private context;
    private templateHelper;
    query: QueryAPI;
    filter: FilterAPI;
    linkage: LinkageAPI;
    private constructor();
    /**
     * 创建并初始化 SDK 实例
     * @param options 用于准备模拟运行环境的配置
     */
    static create(options: EnvironmentOptions): Promise<FineBIQueryDataSDK>;
    /**
     * 销毁并释放资源
     */
    destroy(): void;
}

export { type EnvironmentOptions, FilterAPI, type FilterOptions, type FineBIContext, FineBIQueryDataSDK, LinkageAPI, type LinkageOptions, type LinkageTarget, QueryAPI, type QueryOptions, type WidgetDataOptions, createBrowserEnvironment, initDashboardCustomPoolEnv, initDashboardDesignConfigure };
