'use static';
/**
 *
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file
 * @kit ArkUI
 */

/**
 * @namespace router
 * @syscap SystemCapability.ArkUI.ArkUI.Full [since 23]
 * @stagemodelonly
 * @since 23 static
 */
declare namespace router {

  /**
   * Router Mode
   *
   * @syscap SystemCapability.ArkUI.ArkUI.Full
   * @stagemodelonly
   * @since 23 static
   */
  export enum RouterMode {

    /**
     * Default route mode.
     * The page will be added to the top of the page stack.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    Standard,

    /**
     * Single route mode.
     * If the target page already has the same url page in the page stack,
     * the same url page closest to the top of the stack will be moved to the top of the stack.
     * If the target page url does not exist in the page stack, route will use default route mode.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    Single
  }

  /**
   *
   * @syscap SystemCapability.ArkUI.ArkUI.Lite
   * @since 23 static
   */
  interface RouterOptions {

    /**
     * URI of the destination page, which supports the following formats:
     * 1. Absolute path of the page, which is provided by the pages list in the config.json file.
     * Example:
     * pages/index/index
     * pages/detail/detail
     * 2. Particular path. If the URI is a slash (/), the home page is displayed.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Lite
     * @since 23 static
     */
    url: string;

    /**
     * Data that needs to be passed to the destination page during navigation.
     * After the destination page is displayed, the parameter can be directly used for the page.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Lite
     * @stagemodelonly
     * @since 23 static
     */
    params?: Object;

    /**
     * Set router page stack can be recovered after application is destroyed. When router page stack is recovered,
     * top page will be recovered, other page recovered when it backs. the default value is 'true'.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Lite
     * @since 23 static
     */
    recoverable?: boolean;
  }

  /**
   *
   * @syscap SystemCapability.ArkUI.ArkUI.Full
   * @stagemodelonly
   * @since 23 static
   */
  interface RouterState {

    /**
     * Index of the current page in the stack.
     * NOTE: The index starts from 1 from the bottom to the top of the stack.
     * The value range is all integers.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    index: int;

    /**
     * Name of the current page, that is, the file name.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    name: string;

    /**
     * Path of the current page.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    path: string;

    /**
     * Data that passed to the destination page during navigation.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    params: Object;
  }

  /**
   *
   * @syscap SystemCapability.ArkUI.ArkUI.Full
   * @stagemodelonly
   * @since 23 static
   */
  interface EnableAlertOptions {

    /**
     * dialog context.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    message: string;
  }

  /**
   *
   * @syscap SystemCapability.ArkUI.ArkUI.Full
   * @stagemodelonly
   * @since 23 static
   */
  interface NamedRouterOptions {

    /**
     * Name of the destination named route.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    name: string;

    /**
     * Data that needs to be passed to the destination page during navigation.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    params?: Object;

    /**
     * Set router page stack can be recovered after application is destroyed. When router page stack is recovered,
     * top page will be recovered, other page recovered when it backs. the default value is 'true'.
     *
     * @syscap SystemCapability.ArkUI.ArkUI.Lite
     * @since 23 static
     */
    recoverable?: boolean;
  }
}

export default router;