import { DeepPartial } from '@refinitiv-data/common';
import { LogLevelDesc as LogLevel } from 'loglevel';
export { LogLevel };
import { CONFIG_FILE_UPDATED, NEW_CONFIG_VALUE_SET } from './contracts';
export interface ConfigEvents<T> {
    [CONFIG_FILE_UPDATED]: (newConfig: T, source: string) => void;
    /**
     * @param newConfig - entire updated config
     * @param path - path to property that has been changed (e.g. 'logs.level')
     * @param value - new value that has been applied in the config (e.g. 'trace')
     */
    [NEW_CONFIG_VALUE_SET]: (newConfig: T, path: string, value: any) => void;
    [event: string]: (...args: any[]) => void;
}
export declare enum StreamingType {
    OMM = "OMM",
    RDP = "RDP"
}
export interface StreamingConnectionConfig {
    url: string;
    endpoints: {
        [key: string]: StreamingConnectionEndpointConfig;
    };
}
export interface StreamingConnectionEndpointConfig {
    protocols: StreamingType[];
    locations: string[];
    path: string;
    /**
     * Allows to force the websocket URL.
     * When this parameter is set, the library does not need to send a request
     * to the discovery endpoint but should just use this url to open the websocket
     */
    'websocket-url': string;
}
export interface ConfigEndpoint {
    url: string;
    endpoints: {
        [subpath: string]: string;
    };
}
export interface Datagrid extends ConfigEndpoint {
    'underlying-platform': UnderlyingPlatform;
    layout: PlatformLayout;
}
export declare const enum UnderlyingPlatform {
    RDP = "rdp",
    UDF = "udf"
}
export interface PlatformLayout {
    [UnderlyingPlatform.RDP]: {
        output: string;
    };
    [UnderlyingPlatform.UDF]: {
        layout: {
            columns: LayoutItem[];
            rows: LayoutItem[];
        };
    };
}
export interface LayoutItem {
    item: string;
    [key: string]: string;
}
export interface SessionBasicConfig {
    'base-url': string;
    apis?: DeepPartial<{
        data: {
            [endpointName: string]: ConfigEndpoint;
        };
        discovery: {
            [endpointName: string]: ConfigEndpoint;
        };
        tsi: {
            [endpointName: string]: ConfigEndpoint;
        };
        streaming: {
            [connection: string]: StreamingConnectionConfig;
        };
    }>;
}
export interface DefaultPlatformSessionConfig extends SessionBasicConfig {
    'auto-reconnect': boolean;
    auth: {
        url: string;
        authorize: string;
        token: string;
    };
    'realtime-distribution-system': {
        url: string;
        dacs: {
            username: string;
            'application-id': string;
            position: string;
        };
    };
}
export interface DefaultDesktopSessionConfig extends SessionBasicConfig {
    'platform-paths': {
        rdp: string;
        udf: string;
        tsi: string;
    };
    'handshake-url': string;
}
export interface ConfigEnvironment {
    platform: string;
    dir: string;
}
export interface ConfigConsoleTransport {
    enabled: boolean;
}
export interface ConfigFileTransport {
    enabled: boolean;
    /**
     * Log file name
     * At the begging of this name Date-Time-FileCount-PID will be added
     * e.g. final name of a log file after rotation will be 20200916-1720-01-20566-refinitiv-data-lib
     */
    name: string;
    /**
     * Size of a single log file
     * 'B' - Bites, example - size: "300B" - Rotates the file when size exceeds 300 Bytes. Useful for tests
     * 'K' - KiloBites, example - size: "300K" - Rotates the file when size exceeds 300 KiloBytes
     * 'M' - MegaBytes, example - size: "100M" - Rotates the file when size exceeds 100 MegaBytes
     * 'G' - GigaBytes, example - size: "1G" - Rotates the file when size exceeds a GigaByte
     */
    size: string;
    /**
     * File rotation interval
     * 's' - Seconds. Accepts integer divider of 60, example - interval: "5s" - Rotates at seconds 0, 5, 10, 15 and so on. Useful for tests
     * 'm'- Minutes. Accepts integer divider of 60, example - interval: "5m" - Rotates at minutes 0, 5, 10, 15 and so on
     * 'h' - Hours. Accepts integer divider of 24, example - interval: "2h" - Rotates at midnight, 02:00, 04:00 and so on
     * 'd' - Days. Integer, example - interval: "1d" - Rotates at every midnight
     * 'M' - Months. Integer, example - interval: "1M" - Rotates at every midnight between two distinct months
     */
    interval: string;
    /**
     * Maximum count of log files
     */
    maxFiles: number;
    /**
     * Total disk memory allowed to write log files
     */
    maxSize: string;
    /**
     * Name of the file with history of rotated files
     */
    history: string;
}
export interface HttpConfig {
    'request-timeout': number;
}
export interface ConfigSchema extends ConfigEnvironment {
    'config-change-notifications-enabled': boolean;
    http: HttpConfig;
    logs: {
        level: LogLevel;
        /**
         * filter: '*', - Allows logs of all modules (No filtering)
         * filter: "module:a,module:b,module:c", - Allows logs only of three specific modules: "module:a" and "module:b" and "module:c"
         * filter: "*,-module:a", - Allows logs of all modules except "module:a" (minus '-')
         * filter: "module:*,-module:b,-module:c", - Allows the logs for all modules where the name begins with "module:" but disables logs for modules "module:b" and "module:c"
         */
        filter: string;
        transports: {
            console: ConfigConsoleTransport;
            file: ConfigFileTransport;
            [transportName: string]: any;
        };
    };
    sessions: {
        platform: {
            'default-session': DefaultPlatformSessionConfig;
            [customSession: string]: Partial<DefaultPlatformSessionConfig>;
        };
        desktop: {
            'default-session': DefaultDesktopSessionConfig;
            [customSession: string]: Partial<DefaultDesktopSessionConfig>;
        };
    };
    apis: {
        data: {
            'historical-pricing': {
                url: string;
                endpoints: {
                    events: string;
                    'interday-summaries': string;
                    'intraday-summaries': string;
                };
            };
            'quantitative-analytics-financial-contracts': {
                url: string;
                endpoints: {
                    'financial-contracts': string;
                };
            };
            'quantitative-analytics-curves-and-surfaces': {
                url: string;
                endpoints: {
                    'forward-curves': string;
                    surfaces: string;
                    'zc-curves': string;
                    'zc-curve-definitions': string;
                };
            };
            'quantitative-analytics-dates-and-calendars': {
                url: string;
                endpoints: {
                    'add-periods': string;
                    c3: string;
                    'count-periods': string;
                    'date-schedule': string;
                    holidays: string;
                    'is-working-day': string;
                };
            };
            news: {
                url: string;
                endpoints: {
                    headlines: string;
                    stories: string;
                };
            };
            'environmental-social-governance': {
                url: string;
                endpoints: {
                    universe: string;
                    basic: string;
                    'measures-full': string;
                    'measures-standard': string;
                    'scores-full': string;
                    'scores-standard': string;
                };
            };
            datagrid: {
                url: string;
                endpoints: {
                    standard: string;
                };
                'underlying-platform': UnderlyingPlatform;
                layout: PlatformLayout;
            };
            [endpointName: string]: ConfigEndpoint | Datagrid;
        };
        discovery: {
            search: {
                url: string;
                endpoints: {
                    search: string;
                    lookup: string;
                    metadata: string;
                };
            };
            [endpointName: string]: ConfigEndpoint;
        };
        tsi: {
            metadata: {
                url: string;
                endpoints: {
                    'global-metadata': string;
                    'instrument-metadata': string;
                    partialbar: string;
                    viewlist: string;
                };
            };
            [endpointName: string]: ConfigEndpoint;
        };
        streaming: {
            pricing: StreamingConnectionConfig;
            'trading-analytics': StreamingConnectionConfig;
            'quantitative-analytics': StreamingConnectionConfig;
            benchmark: StreamingConnectionConfig;
            'custom-instruments': StreamingConnectionConfig;
            [connection: string]: StreamingConnectionConfig;
        };
    };
}
