import type Accessor from "../../core/Accessor.js";
import type SceneView from "../../views/SceneView.js";
import type DiscreteOptions from "./DiscreteOptions.js";
import type DurationOptions from "./DurationOptions.js";
import type ThresholdOptions from "./ThresholdOptions.js";
import type { ScreenPoint } from "../../core/types.js";
import type { ShadowVisualizationType } from "./types.js";
import type { ThresholdOptionsProperties } from "./ThresholdOptions.js";
import type { DurationOptionsProperties } from "./DurationOptions.js";
import type { DiscreteOptionsProperties } from "./DiscreteOptions.js";

/** @deprecated since 5.0. Use the [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ShadowCastAnalysis.html) or [Shadow Cast component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-shadow-cast/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). */
export interface ShadowCastViewModelProperties extends Partial<Pick<ShadowCastViewModel, "endTimeOfDay" | "startTimeOfDay" | "utcOffset" | "view" | "visualizationType">> {
  /**
   * The calendar date used to calculate the shadow cast. This date excludes
   * the time. If a date with a time is set, the time value will be set to midnight (`00:00:00`) of that date in local system time.
   * If no date is set, then it defaults to the current date in local system time.
   *
   * @example widget.viewModel.date = new Date('June 1, 2021');
   */
  date?: (Date | number | string);
  /** The configuration used when the widget's [visualizationType](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast-ShadowCastViewModel.html#visualizationType) is set to "discrete". */
  discreteOptions?: DiscreteOptionsProperties;
  /** The configuration used when the widget's [visualizationType](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast-ShadowCastViewModel.html#visualizationType) is set to "duration". */
  durationOptions?: DurationOptionsProperties;
  /** The configuration used when the widget's [visualizationType](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast-ShadowCastViewModel.html#visualizationType) is set to "threshold". */
  thresholdOptions?: ThresholdOptionsProperties;
}

/** @deprecated since 5.0. Use the [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ShadowCastAnalysis.html) or [Shadow Cast component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-shadow-cast/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). */
export type ShadowCastState = "disabled" | "ready";

/**
 * Provides the logic for the [ShadowCast](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast.html) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-shadow-cast/).
 *
 * @deprecated since 5.0. Use the [Shadow Cast component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-shadow-cast/) or [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ShadowCastAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 4.21
 * @see [ShadowCast](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast.html) widget - _Deprecated since 5.0. Use the [Shadow Cast component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-shadow-cast/) instead._
 * @see [Shadow Cast component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-shadow-cast/)
 * @see [Sample - Shadow cast](https://developers.arcgis.com/javascript/latest/sample-code/widgets-shadow-cast/)
 * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
 */
export default class ShadowCastViewModel extends Accessor {
  constructor(properties?: ShadowCastViewModelProperties);
  /**
   * The calendar date used to calculate the shadow cast. This date excludes
   * the time. If a date with a time is set, the time value will be set to midnight (`00:00:00`) of that date in local system time.
   * If no date is set, then it defaults to the current date in local system time.
   *
   * @example widget.viewModel.date = new Date('June 1, 2021');
   */
  get date(): Date;
  set date(value: (Date | number | string));
  /** The configuration used when the widget's [visualizationType](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast-ShadowCastViewModel.html#visualizationType) is set to "discrete". */
  get discreteOptions(): DiscreteOptions;
  set discreteOptions(value: DiscreteOptionsProperties);
  /** The configuration used when the widget's [visualizationType](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast-ShadowCastViewModel.html#visualizationType) is set to "duration". */
  get durationOptions(): DurationOptions;
  set durationOptions(value: DurationOptionsProperties);
  /**
   * Time (in milliseconds from midnight of the [date](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast-ShadowCastViewModel.html#date)) when the shadow cast computation should stop.
   * By default the shadow cast end time is set to 4PM (16 * 3600 * 1000ms).
   *
   * @default 16 * 3600 * 1000
   */
  accessor endTimeOfDay: number;
  /**
   * Time (in milliseconds from midnight of the [date](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast-ShadowCastViewModel.html#date))
   * when the shadow cast computation should start. By default the shadow
   * cast start time is set to 10AM (10 * 3600 * 1000ms).
   *
   * @default 10 * 3600 * 1000
   */
  accessor startTimeOfDay: number;
  /**
   * The current state of the view model that can be used for rendering the UI
   * of the widget.
   *
   * Value | Description
   * ------------|-------------
   * disabled | widget is being created
   * ready | widget is ready
   *
   * @default "disabled"
   */
  get state(): ShadowCastState;
  /** The configuration used when the widget's [visualizationType](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-ShadowCast-ShadowCastViewModel.html#visualizationType) is set to "threshold". */
  get thresholdOptions(): ThresholdOptions;
  set thresholdOptions(value: ThresholdOptionsProperties);
  /** The difference in hours between UTC time and the times displayed in the widget. */
  accessor utcOffset: number;
  /**
   * A reference to the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html). This widget is only supported in a
   * [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
   */
  accessor view: SceneView | null | undefined;
  /**
   * Type of visualization to use when showing the shadows. There are 3 types of visualization:
   * - "threshold" only displays areas that receive shadows for a period longer than
   * a given threshold value
   * - "duration" displays all areas that receive shadows either in a continuous mode or in 1 hour time intervals
   * - "discrete" mode displays individual shadows cast at a given time interval
   *
   * @default "threshold"
   */
  accessor visualizationType: ShadowVisualizationType;
  /**
   * Returns the time (in milliseconds) spent in shadow for a certain point on the screen.
   *
   * @param point - The point on the screen for which shadow cast is calculated.
   * @returns Resolves with the time in milliseconds spent in shadow for the given screenpoint.
   */
  getDuration(point: ScreenPoint): Promise<number>;
  /** Starts the widget. While running it will automatically perform shadow accumulation. */
  start(): void;
  /** Stops the widget. */
  stop(): void;
}