import { IEventTelemetry, IExceptionTelemetry, ITraceTelemetry, IMetricTelemetry } from '@microsoft/applicationinsights-common';
import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
import { IApplicationInsights } from '@microsoft/applicationinsights-web';
/**
 * References to the Application Insights module only uses interfaces from it. There are therefore
 * no traces of application insights code in a compiled app using the Twinfinity client API (unless the app itself uses application insights)
 * Application Insights is set as a peer dependency to indicate that it is a good idea to use it
 * but this is not a requirement
 *
 * If users of Twinfinity client api use Application Insights then logs from embedded will
 * be forwarded to application insights (can be one of our instances or a customer instance). By default,
 * all logs end up in the console. If Application Insights is already registered in the page
 * then logs will be forwarded to Application Insights.
 */
/**
 * Interface that describes the methods used by Twinfinity client API to log telemetry. Basically a subset of Microsoft Application Insights.
 * Application Insights can be used in an application that includes the Twinfinity client API and then uses the Twinfinity client API to forward its internal logs to
 * Application Insights. See Application Insights documentation for description of each of the methods.
 */
export type TwinfinityTelemetryClient = Pick<IApplicationInsights, 'trackEvent' | 'trackException' | 'trackTrace' | 'trackMetric' | 'setAuthenticatedUserContext'>;
/**
 * Represents a telemetry event that can be use to track events.
 */
export declare class TelemetryEvent {
    readonly name: string;
    private readonly _client;
    private readonly _sw;
    /**
     * Creates a new instance of TelemetryEvent.
     * @param name The name of the telemetry event.
     * @param _client The telemetry client used to track the event.
     */
    constructor(name: string, _client: TwinfinityTelemetryClient);
    /**
     * Stops the telemetry event and tracks it with the specified custom properties.
     * Also adds a duration in ms to the logged event properties.
     * @param customProperties Optional custom properties to be associated with the event.
     */
    stop(customProperties?: ICustomProperties): void;
}
/**
 * Configuration used when registering {@link TwinfinityTelemetryClient} instances
 * in {@link CompoundTelemetryClient}. Normally done by calling {@link telemetry}.set().
 */
export interface TwinfinityTelemetryClientConfig {
    /**
     * Name of {@link client}. Name should be unique.
     */
    name: string;
    /** {@link TwinfinityTelemetryClient} instance.*/
    client: TwinfinityTelemetryClient;
    /**
     * BabylonJS logs are normally sent to {@link client}. Setting this to `true`
     * ensures that they aren't.
     */
    disableBabylonJSLoggerForwarding?: boolean;
}
/**
 * Used to combine a set of {@link TwinfinityTelemetryClient} instances and
 * have calls to the trackXYZ methods, on this instance, forwarded to them.
 */
export declare class CompoundTelemetryClient implements TwinfinityTelemetryClient {
    private readonly _clients;
    private static readonly _babylonJSRawLogs;
    private static readonly _anonymousUserId;
    private static readonly _noAccountId;
    private _userId;
    private _accountId;
    /** Optional Role name that application insights will report. A good idea is to use application name for this. */
    role?: string;
    /** AccountId that application insights will report. In twinfinity its a good idea to set it to the
     * customer hostname.
     */
    get accountId(): string;
    /** User id that application insights will report. In twinfinity its a good idea to set this to the
     * logged in user.
     */
    get userId(): string;
    /**
     * Constructor. While possible to use one should probably use {@link createDefault} instead.
     */
    constructor();
    /**
     * Set the authenticated user id and the account id. Used for identifying a specific signed-in user. Parameters must not contain whitespace or ,;=|
     *
     * The method will only set the `authenticatedUserId` and `accountId` in the current page view. To set them for the whole session, you should set `storeInCookie = true`
     * @param {string} authenticatedUserId
     * @param {string} [accountId]
     * @param {boolean} [storeInCookie=false]
     */
    setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string | undefined, storeInCookie?: boolean | undefined): void;
    /**
     * Creates the default {@link CompoundTelemetryClient} instance.
     * It will log to console by default and if it detects a application insights
     * instance in the page it will use that as well.
     */
    static createDefault(): CompoundTelemetryClient;
    /**
     * `true` if console logging is enabled, otherwise `false`.
     */
    get isConsoleLoggingEnabled(): boolean;
    /**
     * Set to `true` to enable console logging. `false` to disable.
     */
    set isConsoleLoggingEnabled(v: boolean);
    /**
     * Iterator for all registered {@link TwinfinityTelemetryClientConfig}.
     * See {@link set} and {@link delete} as well.
     * @returns Iterator for all registered {@link TwinfinityTelemetryClientConfig}.
     */
    entries(): IterableIterator<TwinfinityTelemetryClientConfig>;
    /**
     * Register a {@link TwinfinityTelemetryClientConfig} instance. Future calls to trackXYZ methods
     * will be forwarded to the client property of this instance.
     * @param o a {@link TwinfinityTelemetryClientConfig}.
     */
    set(o: TwinfinityTelemetryClientConfig): void;
    /**
     * Unregister a {@link TwinfinityTelemetryClientConfig}. Calls to the trackXYZ methods will no longer be forwarded to that
     * instance.
     * @param name Name of {@link TwinfinityTelemetryClientConfig} to delete.
     * @returns `true` if {@link TwinfinityTelemetryClientConfig} existed (and hence was deleted), otherwise `false`
     */
    delete(name: string): boolean;
    /** Track an event. See Application insights documentation for more information */
    trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
    /**
     * Starts tracking an event with the given name.
     * @param name - The name of the event to track.
     */
    startTrackEvent(name: string): TelemetryEvent;
    /** Track an exception. See Application insights documentation for more information */
    trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties): void;
    /** Track a trace. See Application insights documentation for more information */
    trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties): void;
    /** Track a metric. See Application insights documentation for more information */
    trackMetric(metric: IMetricTelemetry, customProperties?: ICustomProperties): void;
    private static createRawBabylonJSLogsObservable;
    private isApplicationInsightsClient;
}
/**
 * Use for telemetry logging. Use this instead of console.log and similiar. It is used internally by
 * the Twinfinity Client API.
 * By default logs are output to console. If application insights is detected in the page,
 * when `telemetry` is first accessed, then it will also automatically log to application insights.
 *
 * Simplest way to forward logs to application insights is to use the "Snippet based setup"
 * from https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript.
 * Ensure that the snippet comes before all other scripts in the page.
 *
 * @example
 * ```typescript
 * // Log a warning.
 * telemetry.traceTrace({message: "log message", severityLevel: 2});
 * ```
 * @example
 * ```typescript
 * // Explicitly register existing application insights instance. See "npm based setup" at
 * // https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript for how to get the instance.
 * telemetry.set('myApplicationInsights', applicationInsightsInstance);
 * telemetry.traceTrace({message: "log message" }); // Log a debug log. Same output as console.log
 * ```
 * @example
 * ```typescript
 * // Explicitly register custom telemetryclient
 * class CustomClient implements TwinfinityTelemetryClient { ... }
 * telemetry.set('customclient', new CustomClient());
 * telemetry.isConsoleLoggingEnabled = false; // Disable console logging
 * // Log a debug log. Will be forwarded to the custom client. If
 * // application insights was registered in the page then the log will be sent
 * // there too.
 * telemetry.traceTrace({message: "log message" });
 * ```
 */
export declare const telemetry: CompoundTelemetryClient;
//# sourceMappingURL=Telemetry.d.ts.map