import type Graphic from "../../Graphic.js";
import type PopupTemplate from "../../PopupTemplate.js";
import type Polyline from "../../geometry/Polyline.js";
import type { ClonableMixin, ClonableMixinProperties } from "../../core/Clonable.js";
import type { JSONSupport, JSONSupportMixinProperties } from "../../core/JSONSupport.js";
import type { DirectionLineType } from "./types.js";
import type { PolylineProperties } from "../../geometry/Polyline.js";
import type { PopupTemplateProperties } from "../../PopupTemplate.js";

export interface DirectionLineProperties extends JSONSupportMixinProperties, ClonableMixinProperties, Partial<Pick<DirectionLine, "directionLineType" | "distance" | "duration">> {
  /** Polyline representing the direction's location. */
  geometry?: PolylineProperties | null;
  /**
   * The template for displaying content in a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when the graphic is selected.
   *
   * @since 4.30
   */
  popupTemplate?: PopupTemplateProperties | null;
}

/**
 * The DirectionLine represents polylines associated with individual direction items.
 *
 * @since 4.23
 * @see [RouteParameters](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-RouteParameters.html)
 * @see [RouteLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-RouteLayer.html)
 * @example
 * // Print the distance and time between each direction.
 * const routeLayer = new RouteLayer({
 *   portalItem: {
 *     id: "69569b47b1e445b8a42ec12feab41ce9"
 *   }
 * });
 * await routeLayer.load();
 *
 * const locale = "en-US";
 * const formatMinutes = new Intl.NumberFormat(locale, {
 *   minimumFractionDigits: 1,
 *   maximumFractionDigits: 1
 * });
 * const formatDistance = new Intl.NumberFormat(locale, {
 *   minimumFractionDigits: 0,
 *   maximumFractionDigits: 0
 * });
 *
 *  for (const directionLine of routeLayer.directionLines) {
 *   const { distance, duration } = directionLine;
 *   console.log(`Drive ${formatDistance.format(distance)} meters for ${formatMinutes.format(duration)} minutes.`);
 * }
 *
 * // Drive 76 meters for 0.4 minutes.
 * // Drive 77 meters for 0.2 minutes.
 * // Drive 150 meters for 0.2 minutes.
 * // Drive 3,670 meters for 2.6 minutes.
 * // Drive 307 meters for 0.2 minutes.
 * // Drive 6,293 meters for 4.5 minutes.
 * // Drive 42,276 meters for 29.2 minutes.
 * // etc.
 */
export default class DirectionLine extends DirectionLineSuperclass {
  /**
   * Creates a [DirectionLine](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-DirectionLine.html) from the parsed [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html).
   * The method assumes that the graphic's attributes conform to the route layer item schema.
   *
   * @param graphic - A Graphic instance.
   * @returns A DirectionLine instance.
   * @since 4.24
   */
  static fromGraphic(graphic: Graphic): DirectionLine;
  constructor(properties?: DirectionLineProperties);
  /** The type of line which is defined by esriDirectionLineType. */
  accessor directionLineType: DirectionLineType | null | undefined;
  /** Length of the line measured in meters. */
  accessor distance: number | null | undefined;
  /** Time of the line measured in minutes. Means how much time is required to go along the line. */
  accessor duration: number | null | undefined;
  /** Polyline representing the direction's location. */
  get geometry(): Polyline | null | undefined;
  set geometry(value: PolylineProperties | null | undefined);
  /**
   * The template for displaying content in a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when the graphic is selected.
   *
   * @since 4.30
   */
  get popupTemplate(): PopupTemplate | null | undefined;
  set popupTemplate(value: PopupTemplateProperties | null | undefined);
  get type(): "direction-line";
  /**
   * Creates a [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) from the [DirectionLine](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-DirectionLine.html) instance.
   * The resulting graphic will have attributes that conform to the route layer item schema.
   *
   * @returns A Graphic instance.
   * @since 4.24
   */
  toGraphic(): Graphic;
}
declare const DirectionLineSuperclass: typeof JSONSupport & typeof ClonableMixin