import type PopupTemplate from "../../PopupTemplate.js";
import type AggregateField from "./AggregateField.js";
import type TrackPartInfo from "./TrackPartInfo.js";
import type TimeInterval from "../../time/TimeInterval.js";
import type { ClonableMixin } from "../../core/Clonable.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { AggregateFieldProperties } from "./AggregateField.js";
import type { TrackPartInfoProperties } from "./TrackPartInfo.js";
import type { TimeIntervalProperties } from "../../time/TimeInterval.js";
import type { PopupTemplateProperties } from "../../PopupTemplate.js";

export interface TrackInfoProperties extends Partial<Pick<TrackInfo, "enabled" | "maxDisplayObservationsPerTrack" | "popupEnabled" | "timeField">> {
  /**
   * An array of aggregate fields that summarize [layer.fields](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fields)
   * in all observations of the track. Only visible observations are included in the aggregated data.
   * Observations filtered out because of [maxDisplayObservationsPerTrack](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#maxDisplayObservationsPerTrack) or [maxDisplayDuration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#maxDisplayDuration)
   * are excluded from any aggregate field calculations.
   *
   * These fields may only be used by the [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#popupTemplate), and by the
   * [TrackPartInfo.labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackPartInfo/#labelingInfo) and
   * [TrackPartInfo.renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackPartInfo/#renderer) of [trackLines](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#trackLines).
   *
   * @example
   * // Based on the fields in the layer, the following track info fields
   * // could be defined:
   * trackInfo.fields = [{
   *   name: "total_observations",
   *   statisticType: "count"
   * }, {
   *   name: "AVG_speed",
   *   onStatisticField: "speed",
   *   statisticType: "avg"
   * }];
   */
  fields?: AggregateFieldProperties[];
  /**
   * Configuration properties for displaying the latest observations.
   *
   * @example
   * trackInfo.latestObservations = {
   *   renderer: {
   *     type: "simple",
   *     symbol: {
   *       type: "simple-marker",
   *       style: "circle",
   *       color: "red",
   *       size: 10
   *     }
   *   }
   * };
   */
  latestObservations?: TrackPartInfoProperties;
  /**
   * The maximum age of displayed observations. Observations older than this will not be displayed.
   * Age is calculated by subtracting the time indicated by [timeField](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#timeField)
   * from the [view.timeExtent.end](https://developers.arcgis.com/javascript/latest/references/core/views/View/#timeExtent). For [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/), age
   * is calculated by subtracting the time indicated by [timeField](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#timeField)
   * from the system time. If no duration is specified, or if its value is 0, then displayed observations will not be limited by age.
   *
   * @example trackInfo.maxDisplayDuration = { value: 30, unit: "seconds" };
   */
  maxDisplayDuration?: TimeIntervalProperties | null;
  /**
   * The [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) to apply to the track. When set, a popupTemplate
   * independent of the [layer.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#popupTemplate) is used.
   * This popup can display summary information for each track, such as feature count or any other field defined in [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#fields).
   *
   * The PopupTemplate may contain one or more [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions following
   * the specification defined by the [Arcade Feature Reduction Popup Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-reduction-popup).
   * Expressions must return a string or a number.
   *
   * @see [Arcade Feature Reduction Popup Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-reduction-popup)
   * @example
   * layer.trackInfo = {
   *   fields: [{
   *     name: "avg_speed",
   *     alias: "Average speed",
   *     onStatisticField: "speed",
   *     statisticType: "avg"
   *   }, {
   *     name: "total_observations",
   *     statisticType: "count"
   *   }],
   *   popupTemplate: {
   *     content: [{
   *       type: "text",
   *       text: "This track contains <b>{total_observations}</b> features."
   *     }, {
   *       type: "text",
   *       text: "The average speed in this track is <b>{avg_speed}</b>."
   *     }],
   *     fieldInfos: [{
   *       fieldName: "avg_speed",
   *       format: {
   *         digitSeparator: true,
   *         places: 1
   *       }
   *     }]
   *   }
   * };
   */
  popupTemplate?: PopupTemplateProperties | null;
  /**
   * Configuration properties for displaying previous observations.
   *
   * @example
   * trackInfo.previousObservations = {
   *   renderer: {
   *     type: "simple",
   *     symbol: {
   *       type: "simple-marker",
   *       style: "circle",
   *       color: "blue",
   *       size: 10
   *     }
   *   }
   * };
   */
  previousObservations?: TrackPartInfoProperties;
  /**
   * Configuration properties for displaying track lines.
   *
   * @example
   * trackInfo.trackLines = {
   *   renderer: {
   *     type: "simple",
   *     symbol: {
   *       type: "simple-line",
   *       color: "green",
   *       width: 2
   *     }
   *   }
   * };
   */
  trackLines?: TrackPartInfoProperties;
}

/**
 * TrackInfo provides information about how to display and analyze temporal data in a layer.
 * This information includes how to render the latest observations, previous observations, and track lines.
 * It also includes information about how to aggregate data and display popups.
 * TrackInfo is used in the [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/) and [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) classes.
 *
 * @beta
 * @since 4.32
 * @see [Guide - Visualization](https://developers.arcgis.com/javascript/latest/visualization/)
 * @see [StreamLayer.trackInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/#trackInfo)
 * @see [FeatureLayer.trackInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#trackInfo)
 */
export default class TrackInfo extends TrackInfoSuperclass {
  constructor(properties?: TrackInfoProperties);
  /**
   * Indicates whether the track info is enabled.
   *
   * @default true
   * @example trackInfo.enabled = false;
   */
  accessor enabled: boolean;
  /**
   * An array of aggregate fields that summarize [layer.fields](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fields)
   * in all observations of the track. Only visible observations are included in the aggregated data.
   * Observations filtered out because of [maxDisplayObservationsPerTrack](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#maxDisplayObservationsPerTrack) or [maxDisplayDuration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#maxDisplayDuration)
   * are excluded from any aggregate field calculations.
   *
   * These fields may only be used by the [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#popupTemplate), and by the
   * [TrackPartInfo.labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackPartInfo/#labelingInfo) and
   * [TrackPartInfo.renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackPartInfo/#renderer) of [trackLines](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#trackLines).
   *
   * @example
   * // Based on the fields in the layer, the following track info fields
   * // could be defined:
   * trackInfo.fields = [{
   *   name: "total_observations",
   *   statisticType: "count"
   * }, {
   *   name: "AVG_speed",
   *   onStatisticField: "speed",
   *   statisticType: "avg"
   * }];
   */
  get fields(): AggregateField[];
  set fields(value: AggregateFieldProperties[]);
  /**
   * Configuration properties for displaying the latest observations.
   *
   * @example
   * trackInfo.latestObservations = {
   *   renderer: {
   *     type: "simple",
   *     symbol: {
   *       type: "simple-marker",
   *       style: "circle",
   *       color: "red",
   *       size: 10
   *     }
   *   }
   * };
   */
  get latestObservations(): TrackPartInfo;
  set latestObservations(value: TrackPartInfoProperties);
  /**
   * The maximum age of displayed observations. Observations older than this will not be displayed.
   * Age is calculated by subtracting the time indicated by [timeField](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#timeField)
   * from the [view.timeExtent.end](https://developers.arcgis.com/javascript/latest/references/core/views/View/#timeExtent). For [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/), age
   * is calculated by subtracting the time indicated by [timeField](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#timeField)
   * from the system time. If no duration is specified, or if its value is 0, then displayed observations will not be limited by age.
   *
   * @example trackInfo.maxDisplayDuration = { value: 30, unit: "seconds" };
   */
  get maxDisplayDuration(): TimeInterval | null | undefined;
  set maxDisplayDuration(value: TimeIntervalProperties | null | undefined);
  /**
   * The maximum number of observations to display per track. If the value is 0, no limit will be imposed.
   *
   * @default 0
   * @example trackInfo.maxDisplayObservationsPerTrack = 10;
   */
  accessor maxDisplayObservationsPerTrack: number;
  /**
   * Indicates whether to display the popup for the track as defined in the [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#popupTemplate).
   *
   * @default true
   * @example trackInfo.popupEnabled = false;
   */
  accessor popupEnabled: boolean;
  /**
   * The [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) to apply to the track. When set, a popupTemplate
   * independent of the [layer.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#popupTemplate) is used.
   * This popup can display summary information for each track, such as feature count or any other field defined in [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#fields).
   *
   * The PopupTemplate may contain one or more [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expressions following
   * the specification defined by the [Arcade Feature Reduction Popup Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-reduction-popup).
   * Expressions must return a string or a number.
   *
   * @see [Arcade Feature Reduction Popup Profile](https://developers.arcgis.com/javascript/latest/arcade/#feature-reduction-popup)
   * @example
   * layer.trackInfo = {
   *   fields: [{
   *     name: "avg_speed",
   *     alias: "Average speed",
   *     onStatisticField: "speed",
   *     statisticType: "avg"
   *   }, {
   *     name: "total_observations",
   *     statisticType: "count"
   *   }],
   *   popupTemplate: {
   *     content: [{
   *       type: "text",
   *       text: "This track contains <b>{total_observations}</b> features."
   *     }, {
   *       type: "text",
   *       text: "The average speed in this track is <b>{avg_speed}</b>."
   *     }],
   *     fieldInfos: [{
   *       fieldName: "avg_speed",
   *       format: {
   *         digitSeparator: true,
   *         places: 1
   *       }
   *     }]
   *   }
   * };
   */
  get popupTemplate(): PopupTemplate | null | undefined;
  set popupTemplate(value: PopupTemplateProperties | null | undefined);
  /**
   * Configuration properties for displaying previous observations.
   *
   * @example
   * trackInfo.previousObservations = {
   *   renderer: {
   *     type: "simple",
   *     symbol: {
   *       type: "simple-marker",
   *       style: "circle",
   *       color: "blue",
   *       size: 10
   *     }
   *   }
   * };
   */
  get previousObservations(): TrackPartInfo;
  set previousObservations(value: TrackPartInfoProperties);
  /**
   * Indicates which field from the layer's [TimeInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/) will be used to
   * calculate observation ages for [maxDisplayDuration](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#maxDisplayDuration).
   * The `timeReceived` option is the system time when the client received the observation, and is only valid for
   * [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/).
   *
   * @default "startTimeField"
   * @example trackInfo.timeField = "timeReceived";
   */
  accessor timeField: "timeReceived" | "startTimeField" | "endTimeField";
  /**
   * Configuration properties for displaying track lines.
   *
   * @example
   * trackInfo.trackLines = {
   *   renderer: {
   *     type: "simple",
   *     symbol: {
   *       type: "simple-line",
   *       color: "green",
   *       width: 2
   *     }
   *   }
   * };
   */
  get trackLines(): TrackPartInfo;
  set trackLines(value: TrackPartInfoProperties);
}
declare const TrackInfoSuperclass: typeof JSONSupport & typeof ClonableMixin