import type { JSONSupport, JSONSupportMixinProperties } from "../core/JSONSupport.js";

export interface ServerInfoProperties extends JSONSupportMixinProperties, Partial<Pick<ServerInfo, "adminTokenServiceUrl" | "currentVersion" | "hasPortal" | "hasServer" | "server" | "shortLivedTokenValidity" | "tokenServiceUrl" | "webTierAuth">> {}

/**
 * This class contains information about an ArcGIS Server and its token endpoint.
 *
 * @since 4.0
 * @see [IdentityManager](https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html)
 * @see [Access Secure Services](https://developers.arcgis.com/javascript/latest/secure-resources/)
 * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
 * @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
 * @see [Guide topic - CORS](https://developers.arcgis.com/javascript/latest/cors/)
 */
export default class ServerInfo extends JSONSupport {
  constructor(properties?: ServerInfoProperties);
  /** The token service URL used to generate tokens for ArcGIS Server Admin resources. */
  accessor adminTokenServiceUrl: string | null | undefined;
  /**
   * Version of the ArcGIS Server or Portal deployed on the server.
   *
   * > [!WARNING]
   * >
   * > Note: This value will be `8.4` for ArcGIS Online.
   *
   * @see [hasPortal](https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-ServerInfo.html#hasPortal)
   * @see [hasServer](https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-ServerInfo.html#hasServer)
   */
  accessor currentVersion: number | null | undefined;
  /**
   * Indicates whether the [server](https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-ServerInfo.html#server) is a [Portal](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html) instance.
   *
   * @see [IdentityManagerBase#registerServers()](https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManagerBase.html#registerServers)
   * @see [currentVersion](https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-ServerInfo.html#currentVersion)
   */
  accessor hasPortal: boolean | null | undefined;
  /**
   * Indicates whether the [server](https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-ServerInfo.html#server) is an [ArcGIS Server](https://enterprise.arcgis.com/en/server/latest/get-started/windows/what-is-arcgis-for-server-.htm) instance.
   *
   * @see [IdentityManagerBase#registerServers()](https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManagerBase.html#registerServers)
   * @example
   * // Register the serverInfo with the IdentityManager
   * esriId.registerServers([{
   *   hasServer: true,
   *   server: "https://<server domain>/arcgis",
   *   tokenServiceUrl: "https://<server domain>/arcgis/tokens/"
   * }]);
   */
  accessor hasServer: boolean | null | undefined;
  /** The server URL. This value includes the path to the web adapter for Servers (e.g. https://sampleserver6.arcgisonline.com/arcgis) and Portals (e.g. https://portal.esri.com/gis). */
  accessor server: string | null | undefined;
  /** Validity of short-lived token in minutes. */
  accessor shortLivedTokenValidity: number | null | undefined;
  /** The token service URL used to generate tokens for the secured resources on the server. */
  accessor tokenServiceUrl: string | null | undefined;
  /**
   * Indicates whether the server is configured to work with web tier authentication.
   *
   * @see [ArcGIS Server authentication tier](https://enterprise.arcgis.com/en/server/latest/administer/windows/configuring-arcgis-server-s-authentication-tier.htm)
   */
  accessor webTierAuth: boolean | null | undefined;
}