import type TimeInfo from "../support/TimeInfo.js";
import type TimeExtent from "../../time/TimeExtent.js";
import type TimeInterval from "../../time/TimeInterval.js";
import type { TimeInfoProperties } from "../support/TimeInfo.js";
import type { TimeExtentProperties } from "../../time/TimeExtent.js";
import type { TimeIntervalProperties } from "../../time/TimeInterval.js";

export interface TemporalSceneLayerProperties {
  /**
   * The layer's time extent. When the layer's [useViewTime](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#useViewTime) is `false`, the layer
   * instructs the view to show data from the layer based on this time extent.
   * If the `useViewTime` is `true`, and both layer and view time extents are set, then features that fall within
   * the intersection of the view and layer time extents will be displayed.
   * For example, if the layer's time extent is set to display features between 1970 and 1975 and
   * the view has a time extent set to 1972-1980, the effective time on the feature layer will be 1972-1975.
   *
   * @since 4.30
   * @example
   * if (!layer.useViewTime) {
   *   if (layer.timeExtent) {
   *     console.log("Current timeExtent:", layer.timeExtent.start, " - ", layer.timeExtent.end}
   *   } else {
   *     console.log("The layer will display data within the view's timeExtent.");
   *     console.log("Current view.timeExtent:", view.timeExtent.start, " - ", view.timeExtent.end}
   *   }
   * }
   * @example
   * // set the timeExtent on the layer and useViewTime false
   * // In this case, the layer will honor its timeExtent and ignore
   * // the view's timeExtent
   * const layer = new SceneLayer({
   *   url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Paris_3D_Local_WSL2/SceneServer",
   *   timeExtent: {
   *     start: new Date(2014, 4, 18),
   *     end: new Date(2014, 4, 19)
   *   },
   *   useViewTime: false
   * });
   * @example
   * // timeExtent is set on the layer and the view
   * // In this case, the layer will display features that fall
   * // within the intersection of view and layer time extents
   * // features within Jan 1, 1976 - Jan 1, 1981 will be displayed
   * const view = new SceneView({
   *   timeExtent: {
   *     start: new Date(1976, 0, 1),
   *     end: new Date(2002, 0, 1)
   *   }
   * });
   * const layer = new SceneLayer({
   *   url: myUrl,
   *   timeExtent: {
   *     start: new Date(1974, 0, 1),
   *     end: new Date(1981, 0, 1)
   *   }
   * });
   */
  timeExtent?: TimeExtentProperties | null;
  /**
   * TimeInfo provides information such as date fields that store
   * [start](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#startField)
   * and [end](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#endField) time
   * for each feature and the [TimeInfo#fullTimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#fullTimeExtent)
   * for the layer.
   *
   * If timeInfo configuration exists on the service it gets read and used from there. A developer
   * can overwrite or create a timeInfo configuration on initialization.
   * The timeInfo parameters cannot be changed after the layer is [loaded](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#load).
   *
   * TimeInfo's [TimeInfo#startField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#startField) and [endField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#startField)
   * can be `date`, `date-only` or `timestamp-offset` [field type](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#type) for [SceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html)
   * and [BuildingComponentSublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html).
   *
   * @since 4.30
   */
  timeInfo?: TimeInfoProperties | null;
  /**
   * A temporary offset of the time data based on a certain [TimeInterval](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeInterval.html). This allows
   * users to overlay features from two or more time-aware layers with different time extents.
   * For example, if a layer has data recorded for the year 1970, an offset value of 2 years would temporarily shift the data to
   * 1972. You can then overlay this data with data recorded in 1972.
   * A time offset can be used for display purposes only. The query and selection are not affected by the offset.
   *
   * @since 4.30
   */
  timeOffset?: TimeIntervalProperties | null;
}

/**
 * Mixin for scene layers that support time.
 *
 * @since 4.30
 */
export abstract class TemporalSceneLayer {
  constructor(...args: any[]);
  /**
   * The layer's time extent. When the layer's [useViewTime](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#useViewTime) is `false`, the layer
   * instructs the view to show data from the layer based on this time extent.
   * If the `useViewTime` is `true`, and both layer and view time extents are set, then features that fall within
   * the intersection of the view and layer time extents will be displayed.
   * For example, if the layer's time extent is set to display features between 1970 and 1975 and
   * the view has a time extent set to 1972-1980, the effective time on the feature layer will be 1972-1975.
   *
   * @since 4.30
   * @example
   * if (!layer.useViewTime) {
   *   if (layer.timeExtent) {
   *     console.log("Current timeExtent:", layer.timeExtent.start, " - ", layer.timeExtent.end}
   *   } else {
   *     console.log("The layer will display data within the view's timeExtent.");
   *     console.log("Current view.timeExtent:", view.timeExtent.start, " - ", view.timeExtent.end}
   *   }
   * }
   * @example
   * // set the timeExtent on the layer and useViewTime false
   * // In this case, the layer will honor its timeExtent and ignore
   * // the view's timeExtent
   * const layer = new SceneLayer({
   *   url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Paris_3D_Local_WSL2/SceneServer",
   *   timeExtent: {
   *     start: new Date(2014, 4, 18),
   *     end: new Date(2014, 4, 19)
   *   },
   *   useViewTime: false
   * });
   * @example
   * // timeExtent is set on the layer and the view
   * // In this case, the layer will display features that fall
   * // within the intersection of view and layer time extents
   * // features within Jan 1, 1976 - Jan 1, 1981 will be displayed
   * const view = new SceneView({
   *   timeExtent: {
   *     start: new Date(1976, 0, 1),
   *     end: new Date(2002, 0, 1)
   *   }
   * });
   * const layer = new SceneLayer({
   *   url: myUrl,
   *   timeExtent: {
   *     start: new Date(1974, 0, 1),
   *     end: new Date(1981, 0, 1)
   *   }
   * });
   */
  get timeExtent(): TimeExtent | null | undefined;
  set timeExtent(value: TimeExtentProperties | null | undefined);
  /**
   * TimeInfo provides information such as date fields that store
   * [start](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#startField)
   * and [end](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#endField) time
   * for each feature and the [TimeInfo#fullTimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#fullTimeExtent)
   * for the layer.
   *
   * If timeInfo configuration exists on the service it gets read and used from there. A developer
   * can overwrite or create a timeInfo configuration on initialization.
   * The timeInfo parameters cannot be changed after the layer is [loaded](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#load).
   *
   * TimeInfo's [TimeInfo#startField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#startField) and [endField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#startField)
   * can be `date`, `date-only` or `timestamp-offset` [field type](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#type) for [SceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html)
   * and [BuildingComponentSublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html).
   *
   * @since 4.30
   */
  get timeInfo(): TimeInfo | null | undefined;
  set timeInfo(value: TimeInfoProperties | null | undefined);
  /**
   * A temporary offset of the time data based on a certain [TimeInterval](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeInterval.html). This allows
   * users to overlay features from two or more time-aware layers with different time extents.
   * For example, if a layer has data recorded for the year 1970, an offset value of 2 years would temporarily shift the data to
   * 1972. You can then overlay this data with data recorded in 1972.
   * A time offset can be used for display purposes only. The query and selection are not affected by the offset.
   *
   * @since 4.30
   */
  get timeOffset(): TimeInterval | null | undefined;
  set timeOffset(value: TimeIntervalProperties | null | undefined);
}