/// <reference path="./sigApi.ApiBase.d.ts" />
/// <reference path="./sigApi.Route.d.ts" />

declare namespace SigApi {
    interface ApiAppRouter extends ApiBase {
        /**
         * Gets an array of all top level routes (not sorted)
         * 
         * @returns {Route[]} An array of all top level routes
         */
        getRoutes(): Route[]
        /**
         * Returns all routes, which navigates to the given dashboard
         * 
         * @param {string} _id The instanceId of an dashboard
         * 
         * @returns {Route[]|null} An array of all routes for the given id
         */
        getRoutesByInstanceID(id: string): Route[] | null
        /**
         * Gets the current Route
         * 
         * @returns {Route|null} The currently selected route
         */
        getCurrentRoute(): Route | null
        /**
         * Gets the current path
         * 
         * @returns {string} the current path
         */
        getCurrentPath(): string
        /**
         * Navigates to the given path
         * 
         * @param {string} path The path to which should be navigated
         */
        navigate(path: string): void
        /**
         * Navigates to the last visited path
         * @returns {number} error (see sigApi.SIG_CONST.ERROR_* constants)
         */
        navigateBack(): number
        /**
         * Navigates to the last path which was left with navigateBack()
         * @returns {number} error (see sigApi.SIG_CONST.ERROR_* constants)
         */
        navigateForward(): number
        /**
         * Gets the RouteObject which is associated with the given index
         * 
         * @param {number} routeindex The index for which the route-object should be returned
         * 
         * @returns {Route|null} The route-object for the given index, or null if no route was found
         */
        getRouteByIndex(routeindex: number): Route | null
        /**
         * Navigates to the given route
         * 
         * @param {Route} newRoute The route-object to which should be navigated
         */
        switchToRoute(newRoute: Route): void
        /**
         * Gets an sorted array of all used route-indices
         *
         *  @returns {number[]} An sorted array of all used route-indexes
         */
        getSortedIndexList(): number[]
        /**
         * Overloads the active Screen
         * 
         * @param {number|string} dataPointId The id or the name of the datapoint with which the overload should performed
         * @param {number} [selectionGroup] The selection group for which the overload should be performed or undefined for all
         * @param {number|string} [targetDatapointId] The dpId or the name of the datapoints which should be overloaded or undefined for all
         */
        overloadActiveScreen(
            dataPointId: number | string,
            selectionGroup?: number,
            targetDatapointId?: number | string
        ): void
        /**
         * Resets previous overloads
         */
        resetOverloadedActiveScreen(): void
        /**
         * Function to check if parameter object is a instanceof Route.
         * This function can be used without importing the type Route to be used with the instanceof operator.
         * @param {*} object Any object to type check
         * @returns {boolean} Returns true if parameter object is instanceof Route, else false
         */
        instanceofRoute(object: any): boolean
    }
}
