import type PublishingInfo from "../support/PublishingInfo.js";

export interface PublishableLayerProperties {}

/**
 * Mixin for layers that expose the publishing status of the underlying service.
 *
 * @since 4.25
 */
export abstract class PublishableLayer {
  constructor(...args: any[]);
  /**
   * Checks layer's publishing status while the layer is being published to the portal.
   * This stops when the status has been determined or when the layer is destroyed.
   * The layer is automatically refreshed when the layer is done publishing.
   * This is valid only for [ArcGIS Online hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm).
   *
   * @since 4.25
   * @example
   * // Log the current publishing status after each checks.
   * when(
   *   () => !layer.publishingInfo.updating,
   *   (status) => {
   *     switch (layer.publishingInfo.status) {
   *       case "unknown":
   *         console.log("The layer's publishing status is unknown at this point");
   *         break;
   *       case "unavailable":
   *         console.log("The layer doesn't provide publishing information");
   *         break;
   *       case "publishing":
   *         console.log("Layer is publishing");
   *         break;
   *       case "published":
   *         console.log("Layer is published at", layer.url);
   *         break;
   *     }
   *   },
   *   { initial: true }
   * );
   */
  get publishingInfo(): PublishingInfo | null;
}

/**
 * Layer's publishing status while the layer is being published to the portal.
 * The layer is automatically refreshed when the status goes from `publishing` to `unavailable` or `published`.
 *
 * **Possible Values**
 * Value | Description |
 * ----- | ----------- |
 * unknown | The layer's publishing status is unknown at this point.
 * unavailable | The layer doesn't provide publishing information.
 * publishing | The publishing is in progress.
 * published | The layer is published and ready for consumption.
 * 
 *
 * @see [PublishingInfo.status](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-PublishingInfo.html#status)
 */
export type PublishStatus = "unknown" | "unavailable" | "publishing" | "published";