import type Viewpoint from "../Viewpoint.js";
import type { EsriPromise } from "../core/Promise.js";
import type { ViewAnimationStateType } from "./animation/types.js";

export interface ViewAnimationProperties extends Partial<Pick<ViewAnimation, "target">> {}

/**
 * Contains a [state](https://developers.arcgis.com/javascript/latest/references/core/views/ViewAnimation/#state) property used for checking the state of the animation.
 * The view animation is resolved when the animation has `finished` and is
 * rejected if it is `stopped`.
 *
 * ```js
 * reactiveUtils.when(() => view.animation, function(animation) {
 *   console.log(animation.state); // prints out "running"
 *   animation.when(function() {
 *       console.log(animation.state); // prints out "finished"
 *     })
 *     .catch(function() {
 *       console.log(animation.state); // prints out "stopped"
 *     });
 * });
 * ```
 *
 * @since 4.0
 * @see [SceneView.goTo()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#goTo)
 * @see [MapView.animation](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#animation)
 */
export default class ViewAnimation extends EsriPromise {
  constructor(properties?: ViewAnimationProperties);
  /**
   * The state of the animation.
   *
   * The animation terminates when the state is either `finished` or `stopped`
   * and cannot transition again to `running`. The `finished` state
   * indicates the animation has successfully ended, while the `stopped`
   * state indicates that the animation was interrupted before it reached
   * its final target.
   *
   * @default "running"
   */
  get state(): ViewAnimationStateType;
  /** The target of the animation. */
  accessor target: Viewpoint | Promise<Viewpoint> | null | undefined;
  /**
   * Finishes the view animation by immediately going to the target and sets
   * the state of the animation to `finished`.
   */
  finish(): void;
  /**
   * Stops the view animation at its current state and sets the state of
   * the animation to `stopped`.
   */
  stop(): void;
}