import type TimeExtent from "../../time/TimeExtent.js";
import type TimeInterval from "../../time/TimeInterval.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { TimeExtentProperties } from "../../time/TimeExtent.js";
import type { TimeIntervalProperties } from "../../time/TimeInterval.js";

export interface TimeSliderProperties extends Partial<Pick<TimeSlider, "loop" | "numStops" | "numThumbs" | "stopDelay">> {
  /** The current time extent of the time slider. See the [TimeSlider.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#timeExtent) property of the time slider widget for more information. */
  currentTimeExtent?: TimeExtentProperties | null;
  /** The temporal extent for the entire slider. See the [TimeSlider.fullTimeExtent](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#fullTimeExtent) property of the time slider widget for more information. */
  fullTimeExtent?: TimeExtentProperties | null;
  /** Defines regularly spaced stops on the time slider from a [TimeInterval](https://developers.arcgis.com/javascript/latest/references/core/time/TimeInterval/) object. See the time slider widget's [TimeSlider.stops](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#stops) and [StopsByInterval](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/types/#StopsByInterval) properties. */
  stopInterval?: TimeIntervalProperties | null;
  /** An array of dates for the time slider widget. Can be used to create irregularly spaced stops. See the time slider widget's [TimeSlider.stops](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#stops) and [StopsByDates](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/types/#StopsByDates) properties. */
  stops?: (Date | number | string)[] | null;
}

/**
 * The thumb count. See the time slider widget's [TimeSlider.mode](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#mode) and [TimeSlider.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#timeExtent) properties. This value defaults to 1.
 *
 * @see [numThumbs](https://developers.arcgis.com/javascript/latest/references/core/webdoc/widgets/TimeSlider/#numThumbs)
 */
export type ThumbCountType = 1 | 2;

/**
 * Time animation is controlled by a configurable [time slider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/). Those configurations are saved to the web document as a timeSlider widget.
 *
 * @since 4.30
 * @see [WebMap.widgets](https://developers.arcgis.com/javascript/latest/references/core/WebMap/#widgets)
 * @see [WebScene.widgets](https://developers.arcgis.com/javascript/latest/references/core/WebScene/#widgets)
 * @see [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/)
 */
export default class TimeSlider extends JSONSupport {
  constructor(properties?: TimeSliderProperties);
  /** The current time extent of the time slider. See the [TimeSlider.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#timeExtent) property of the time slider widget for more information. */
  get currentTimeExtent(): TimeExtent | null | undefined;
  set currentTimeExtent(value: TimeExtentProperties | null | undefined);
  /** The temporal extent for the entire slider. See the [TimeSlider.fullTimeExtent](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#fullTimeExtent) property of the time slider widget for more information. */
  get fullTimeExtent(): TimeExtent | null | undefined;
  set fullTimeExtent(value: TimeExtentProperties | null | undefined);
  /**
   * When `true`, the time slider will play its animation in a loop.
   *
   * @default false
   */
  accessor loop: boolean;
  /** The number of stops. It divides the time slider's [TimeSlider.fullTimeExtent](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#fullTimeExtent) into equal parts. See the time slider widget's [TimeSlider.stops](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#stops) and [StopsByCount](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/types/#StopsByCount) properties. */
  accessor numStops: number | null | undefined;
  /** The thumb count. See the time slider widget's [TimeSlider.mode](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#mode) and [TimeSlider.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#timeExtent) properties. This value defaults to 1. */
  accessor numThumbs: ThumbCountType;
  /** The time rate in milliseconds between animation steps.  See the time slider widget's [TimeSlider.playRate](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#playRate) property. This value defaults to 1000. */
  accessor stopDelay: number;
  /** Defines regularly spaced stops on the time slider from a [TimeInterval](https://developers.arcgis.com/javascript/latest/references/core/time/TimeInterval/) object. See the time slider widget's [TimeSlider.stops](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#stops) and [StopsByInterval](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/types/#StopsByInterval) properties. */
  get stopInterval(): TimeInterval | null | undefined;
  set stopInterval(value: TimeIntervalProperties | null | undefined);
  /** An array of dates for the time slider widget. Can be used to create irregularly spaced stops. See the time slider widget's [TimeSlider.stops](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/#stops) and [StopsByDates](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/types/#StopsByDates) properties. */
  get stops(): Date[] | null | undefined;
  set stops(value: (Date | number | string)[] | null | undefined);
}