import type SpatialReference from "../../geometry/SpatialReference.js";
import type { SceneServiceVersion } from "../support/types.js";
import type { SpatialReferenceProperties } from "../../geometry/SpatialReference.js";

export interface SceneServiceProperties extends Partial<Pick<SceneService, "copyright" | "layerId" | "url">> {
  /** The spatial reference of the layer. */
  spatialReference?: SpatialReferenceProperties;
}

/** Mixin for layers using a scene service. */
export abstract class SceneService {
  constructor(...args: any[]);
  /** The copyright text as defined by the scene service. */
  accessor copyright: string | null | undefined;
  /**
   * The layer ID, or layer index, of a Scene Service layer. This is particularly useful when
   * loading a single layer with the [portalItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-PortalLayer.html#portalItem) property from a service containing
   * multiple layers. You can specify this value in one of two scenarios:
   *
   * * When loading the layer via the [portalItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-PortalLayer.html#portalItem) property.
   * * When pointing the layer [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-SceneService.html#url) directly to the Scene Service.
   *
   * If a layerId is not specified in either of the above scenarios, then the first layer
   * in the service (`layerId = 0`) is selected.
   *
   * @example
   * // while these examples use a SceneLayer, the same pattern can be
   * // used for other layers that may be loaded from portalItem ids
   *
   * // loads the third layer in the given Portal Item
   * let layer = new SceneLayer({
   *   portalItem: {
   *     id: "73df987984b24094b848d580eb83b0fb"
   *   },
   *   layerId: 2
   * });
   * @example
   * // If not specified, the first layer (layerId: 0) will be returned
   * let layer = new SceneLayer({
   *   portalItem: {
   *     id: "73df987984b24094b848d580eb83b0fb"
   *   }
   * });
   * @example
   * // Can also be used if URL points to service and not layer
   * let layer = new SceneLayer({
   *   url: "https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Trees/SceneServer",
   *   layerId: 0  // Notice that the url doesn't end with /2
   * });
   * @example
   * // This code returns the same layer as the previous snippet
   * let layer = new SceneLayer({
   *   url: "https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Trees/SceneServer/layers/0",
   *   // The layer id is specified in the URL
   * });
   */
  accessor layerId: number;
  /** The spatial reference of the layer. */
  get spatialReference(): SpatialReference;
  set spatialReference(value: SpatialReferenceProperties);
  /**
   * The URL of the REST endpoint of the layer or scene service. The URL may either point to a
   * resource on ArcGIS Enterprise or ArcGIS Online.
   *
   * The layer may be specified using the [layerId](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-SceneService.html#layerId) property when the url points directly to a service and not a specific layer.
   * If [layerId](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-SceneService.html#layerId) is not specified, then it will default to the first layer in the service.
   *
   * @example
   * // Layer from Scene Service on ArcGIS Server
   * let sceneLayer = new SceneLayer({
   *   url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Paris_3D_Local_WSL2/SceneServer/layers/0"
   * });
   * @example
   * // Can also be used if URL points to service and not layer
   * let layer = new SceneLayer({
   *   // Notice that the url doesn't end with /0
   *   url: "https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Trees/SceneServer",
   *   layerId: 0
   * });
   */
  accessor url: string | null | undefined;
  /**
   * The version of the scene service specification used for this service.
   *
   * @see [github.com/Esri/i3s-spec](https://github.com/Esri/i3s-spec)
   * @example
   * // Prints the version to the console - e.g. 1.4, 1.5, etc.
   * console.log(layer.version.versionString);
   */
  get version(): SceneServiceVersion;
}