import type { NotificationsCenter } from '@sisense/sdk-common';
import { DataSource } from '@sisense/sdk-data';
import { PivotQueryClient } from '@sisense/sdk-pivot-query-client';
import { QueryClient } from '@sisense/sdk-query-client';
import type { DisplayNameConfig } from '@sisense/sdk-query-client/dispatcher';
import { HttpClient } from '@sisense/sdk-rest-client';
import { TrackingEventDetails } from '@sisense/sdk-tracking';
import type { Locale } from 'date-fns';
import type { NotificationsConfig } from '../../infra/notifications/types';
import { DateConfig, LoadingIndicatorConfig, TranslationConfig } from '../../types';
import type { AppSettings } from './settings/settings';
/**
 * Application configuration
 *
 * @public
 */
export type AppConfig = {
    /**
     * A [date-fns Locale](https://date-fns.org/v2.30.0/docs/Locale)
     */
    locale?: Locale;
    /**
     * Translation Configuration
     */
    translationConfig?: TranslationConfig;
    /**
     * Date Configurations
     */
    dateConfig?: DateConfig;
    /**
     * Loading Indicator Configurations
     */
    loadingIndicatorConfig?: LoadingIndicatorConfig;
    /**
     * Query Cache Configurations.
     *
     * See [Client query caching guide](/guides/sdk/guides/client-query-caching.html) for more details.
     * @beta
     */
    queryCacheConfig?: {
        /**
         * Whether to enable client-side query caching.
         *
         * If not specified, the default value is `false`
         */
        enabled?: boolean;
    };
    /**
     * Query limit (max rows count that will be fetched in query)
     * @default 20000
     */
    queryLimit?: number;
    /**
     * Accessibility configuration. Set the `accessibilityConfig.enabled` property to `true` to enable accessibility features for charts built with Highcharts.
     *
     * Once the accessibility configuration in enabled, you can use the default descriptions or choose to create custom configurations for the descriptions of a chart, its axes, its series, and values description formatting. To create custom configurations, use the `highchartsOptions` object that is passed to the {@link BeforeRenderHandler} of the chart's `onBeforeRender` callback. Modify the object using the accessibility options as described in the [Accessibility module documentation](https://www.highcharts.com/docs/accessibility/accessibility-module).
     *
     * Note that enabling accessibility also causes markers to appear in charts even if they are disabled using the chart's `styleOptions`.
     *
     * This feature is in alpha.
     */
    accessibilityConfig?: {
        /**
         * Whether to enable accessibility features
         *
         * If not specified, the default value is `false`
         */
        enabled?: boolean;
    };
    /**
     * Configuration of the tabber widgets feature
     *
     * Only tabber widgets that are configured using the Fusion UI as documented [here](https://docs.sisense.com/main/SisenseLinux/tabber.htm#Creating) are supported.
     */
    tabberConfig?: {
        /**
         * Whether to enable tabber widget support
         *
         * If not specified, the default value is `true`
         * @deprecated Tabber widgets are now supported by default and this property is no longer needed.
         */
        enabled?: boolean;
    };
    /**
     * Configuration of the component that is rendered in case of an error
     */
    errorBoundaryConfig?: {
        /**
         * Whether to show error text without hovering over the error icon
         *
         * If not specified, the default value is `false`
         */
        alwaysShowErrorText?: boolean;
    };
    /**
     * Configures the notifications service, which raises user-facing messages
     * about errors such as expired sessions or insufficient permissions.
     * @alpha
     */
    notificationsConfig?: NotificationsConfig;
    /**
     * API Telemetry headers to attach to every request made by the SDK.
     * Attached only when the API Telemetry feature flag is enabled.
     *
     * Support only headers with the prefix 'x-sisense-'.
     * @example
     * ```tsx
     * appConfig={{
     *   apiTelemetryHeaders: {
     *     'x-sisense-embed': 'iframe',
     *   },
     * }}
     * ```
     * @sisenseInternal
     */
    apiTelemetryHeaders?: Record<string, string>;
    /**
     * Tracking configuration
     */
    trackingConfig?: {
        /**
         * Whether to enable or disable tracking in development or test environment.
         *
         * If not specified, the default value is `true`
         *
         * In production, tracking is always enabled.
         * @internal
         */
        enabled?: boolean;
        /**
         * Callback to be invoked when tracking event occurs
         */
        onTrackingEvent?: (payload: TrackingEventDetails) => void;
    };
    /**
     * Configuration of the Jump To Dashboard feature
     *
     * This feature is currently in Beta.
     *
     * **Note:** Only widgets that are configured using the Fusion UI as documented
     * [here](https://docs.sisense.com/main/SisenseLinux/jump-to-dashboard.htm?tocpath=Add-ons%7C_____2#ConfiguringJTDPerWidget)
     * are supported in Compose SDK.
     *
     * Widgets that are configured using an older version of Jump To Dashboard, or via scripts, are not supported.
     *
     * Known limitations:
     * - Target dashboards are always opened in a popup window, options to open in new tab and new window are not supported.
     * - Show 'Header' and 'Dashboards panel' options are not supported (only relevant to Fusion).
     * - 'Reset filters after JTD' is not supported, since changes are never saved to the target dashboard using Compose SDK.
     *
     * The following Jump To Dashboard configuration is supported:
     *   - Target dashboard set by Id, with configurable display title
     *   - 'Popup window' display type ('Allow Resize' not supported)
     *   - Display filter panel on the target dashboard (true/false)
     *   - Navigation setting (Click / Right click)
     *     - Note: 'Keep changes made by user' is not supported, since changes are never saved to the target dashboard using Compose SDK.
     *   - Apply filters to the target dashboard (select)
     *   - Merge target dashboard filters (true/false)
     *
     */
    jumpToDashboardConfig?: {
        /**
         * Whether to enable or disable the Jump To Dashboard feature
         *
         * If not specified, the default value is `true`
         */
        enabled?: boolean;
    };
    /**
     * Configuration of the Narrative feature for widgets
     */
    narrativeConfig?: {
        /**
         * Whether to enable or disable the Widget Narrative feature
         *
         * When `true`, the Widget Narrative feature is enabled if the Fusion server supports it.
         *
         * When `false`, the Widget Narrative feature is disabled.
         *
         * Note: The Widget Narrative feature requires Sisense Intelligence Narratives to be enabled on the connected Sisense Fusion environment.
         * @default true
         */
        enabled?: boolean;
    };
    /**
     * Global configuration for some specific aspects of data visualizations.
     */
    chartConfig?: {
        /** `Table` and `PivotTable` configuration */
        tabular?: {
            /** Configuration for HTML content in `Table` and `PivotTable` */
            htmlContent?: {
                /**
                 * If true, the contents of table and pivot table cells are rendered as HTML instead of text.
                 *
                 * **Note**: The {@link StyledColumn.isHtml} property of columns in `dataOptions` are of higher precedence, and will therefore override this setting.
                 * @default true
                 */
                enabled?: boolean;
                /**
                 * Enables sanitization of HTML content before rendering to prevent XSS attacks.
                 * @default true
                 */
                sanitizeContents?: boolean;
            };
            /**
             * Boolean flag whether to always show the results per page select
             *
             * If `true`, the results per page select will be shown even if there is only one page of results.
             * Currently only supported for `PivotTable`.
             * @default false
             */
            alwaysShowResultsPerPage?: boolean;
        };
        /**
         * Configuration of the default number formatting for visualizations.
         * @sisenseInternal
         */
        defaultNumberFormatting?: {
            /**
             *  If `false`, raw values are displayed without applying the default number formatting configuration.
             * @default true
             */
            enabled?: boolean;
        };
    };
};
/**
 * Stands for a Sisense Client Application which connects to a Sisense Environment
 * @internal
 */
export interface ClientApplication {
    /**
     * Gets the underlying HTTP Client
     */
    readonly httpClient: HttpClient;
    /**
     * Gets the underlying Pivot Query Client
     */
    readonly pivotQueryClient: PivotQueryClient;
    /**
     * Gets the underlying Query Client
     */
    readonly queryClient: QueryClient;
    /**
     * Gets the default data source being used as default for child components with no explicitly defined data source
     */
    readonly defaultDataSource?: DataSource;
    /**
     * Gets the application settings
     */
    settings: AppSettings;
    /**
     * Gets the module to control query cache
     */
    queryCache: {
        /**
         * Clears the query cache
         */
        clear: () => void;
    };
    /**
     * Gets the notifications center holding user-facing messages produced by the SDK.
     * @internal
     */
    readonly notifications: NotificationsCenter;
}
/**
 * Normalized system settings used by CSDK (from `GET api/v1/settings/system`).
 * Wire JSON uses `displayName`; normalize at fetch maps it to `displayNameConfig`.
 */
export type SystemSettings = {
    tracking?: {
        apiTelemetry?: boolean;
    };
    /**
     * Column display-name feature from the configuration service.
     * When `enabled` and `useNewSearchByDisplayNameApi` are both true, field search
     * uses `fields/searchByDisplayName?isLive=` instead of `fields/search`.
     */
    displayNameConfig?: DisplayNameConfig;
};
