import { HttpHeaders, HttpMethod } from '@refinitiv-data/common';
import { ConfigEndpoint, ConfigSchema, StreamingConnectionConfig } from '../config';
import { StateEvents, StateManager } from '../state';
declare const EventReceived: 'eventReceived';
export declare const SessionEvent: {
    EventReceived: "eventReceived";
    Error: "error";
    StateChanged: "stateChanged";
};
/**
 * Each session can report different status events during its lifecycle.
 */
export declare enum SessionEventCode {
    /** The session has failed to authenticate the client. */
    AuthenticationFailed = "authenticationFailed",
    /** The session has successfully authenticated the client. */
    AuthenticationSucceeded = "authenticationSucceeded",
    /** Token refresh failed. */
    RefreshFailed = "refreshFailed",
    /** Token refreshed successfully. */
    RefreshSucceeded = "refreshSucceeded"
}
/**
 * Each session can report different status events during its lifecycle.
 */
export declare enum SessionState {
    /** The session is waiting to be opened or closed. */
    Opened = "Opened",
    /** The session is open and ready to work. */
    Closed = "Closed",
    /** The session is closed. */
    Pending = "Pending"
}
export interface SessionRequiredParams {
    /**
     * In case of Platform session - OAuth clientId.
     * In case of Desktop session - Eikon Application key necessary to authenticate the specific application.
     */
    appKey: string;
}
export interface SessionRequestParams {
    method: HttpMethod;
    query?: {};
    body?: {};
    headers?: HttpHeaders;
    url: string;
    handleAutoRedirect?: boolean;
}
export interface SessionEvents extends StateEvents {
    [EventReceived]: (session: Session, event: SessionEventCode, err?: Error) => void;
    [SessionEvent.Error]: (error: Error, session: Session) => void;
}
/**
 *
 * Session manages your connection to the data platform. Depending on its type, the session communicates either:
 *
 * * Directly with the platform or through a local access point (for example, Refinitiv Real-Time Distribution System or Workspace), or
 * * Through a container application (for example, Workspace or Workspace for Web).
 * * Before it can retrieve any data, your application must create a session and successfully open it.
 *
 * Session object exposes methods for managing the session and since it is an instance of EventEmitter, it allows registering and listening for special events emitted by the session
 */
export interface Session extends StateManager<SessionEvents> {
    readonly rdpUrlRoot?: string;
}
export interface StreamingEndpoint {
    endpoint: string;
    port: string;
    location: string[];
    dataFormat: string[];
    provider: string;
    transport: string;
    locationId?: string;
    privateLink?: string;
    tier?: string;
}
export interface SessionStreamingEndpoints {
    services: StreamingEndpoint[];
}
/**
 * Definition of either Platform, Desktop or Container session
 */
export interface SessionDefinition {
    /**
     * Creates a session instance defined by either Platform, Desktop or Container session definitions
     * @return an instance of Session object
     */
    getSession(): Session;
}
export declare type ApiEndpoints = ConfigSchema['apis'];
export declare type ApiEndpoint = ConfigEndpoint | StreamingConnectionConfig;
export {};
