import type BaseContent from "./Content.js";
import type { PopupContentMediaInfoUnion } from "./types.js";
import type { PieChartMediaInfoProperties } from "./PieChartMediaInfo.js";
import type { LineChartMediaInfoProperties } from "./LineChartMediaInfo.js";
import type { ImageMediaInfoProperties } from "./ImageMediaInfo.js";
import type { ColumnChartMediaInfoProperties } from "./ColumnChartMediaInfo.js";
import type { BarChartMediaInfoProperties } from "./BarChartMediaInfo.js";
import type { ContentProperties as BaseContentProperties } from "./Content.js";

export interface MediaContentProperties extends BaseContentProperties, Partial<Pick<MediaContent, "activeMediaInfoIndex" | "description" | "title">> {
  /**
   * Contains the media elements representing images or charts to display
   * within the [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). This can be an individual
   * chart or image element, or an array containing a combination of any of
   * these types.
   */
  mediaInfos?: ((BarChartMediaInfoProperties & { type: "bar-chart" }) | (ColumnChartMediaInfoProperties & { type: "column-chart" }) | (ImageMediaInfoProperties & { type: "image" }) | (LineChartMediaInfoProperties & { type: "line-chart" }) | (PieChartMediaInfoProperties & { type: "pie-chart" }))[] | null;
}

/**
 * A `MediaContent` popup element contains an individual or array of chart and/or image media elements
 * to display within a popup's content.
 *
 * Chart colors automatically respect renderer colors when visualizing data with the [predominance](https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-symbology-predominance.html),
 * [dot density](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-DotDensityRenderer.html), and [pie chart](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-PieChartRenderer.html) renderers.
 * [Binning](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureReductionBinning.html) and [clustering](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureReductionCluster.html) popup charts are also based on the renderer colors.
 * However, popup charts only respect the colors from the [pie chart](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-PieChartRenderer.html) renderer when clustering is configured.
 *
 * ![popuptemplate-media-element](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popup/popuptemplate-media-element.png)
 *
 * @since 4.11
 * @see [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html)
 * @see [BarChartMediaInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-BarChartMediaInfo.html)
 * @see [ColumnChartMediaInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-ColumnChartMediaInfo.html)
 * @see [LineChartMediaInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-LineChartMediaInfo.html)
 * @see [PieChartMediaInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-PieChartMediaInfo.html)
 * @see [ImageMediaInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-ImageMediaInfo.html)
 * @see [Sample - Intro to PopupTemplate](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/)
 * @see [Sample - Multiple popup elements](https://developers.arcgis.com/javascript/latest/sample-code/popup-multipleelements/)
 * @see [Sample - Pie charts](https://developers.arcgis.com/javascript/latest/sample-code/visualization-pie-chart/)
 * @example
 * layer.popupTemplate.content = [{
 *   // The following creates a piechart in addition to an image. The chart is
 *   // also set  up to work with related tables.
 *   // Autocasts as new MediaContent()
 *   type: "media",
 *   activeMediaInfoIndex: 1,
 *   // Autocasts as array of MediaInfo objects
 *   mediaInfos: [{
 *     title: "<b>Count by type</b>",
 *     type: "pie-chart", // autocasts as new PieChartMediaInfo
 *     // Autocasts as new ChartMediaInfoValue object
 *     value: {
 *       fields: ["relationships/0/Point_Count_COMMON"],
 *       normalizeField: null,
 *       tooltipField: "relationships/0/COMMON"
 *     }
 *   }, {
 *     title: "<b>Mexican Fan Palm</b>",
 *     type: "image", // Autocasts as new ImageMediaInfo object
 *     caption: "tree species",
 *     // Autocasts as new ImageMediaInfoValue object
 *     value: {
 *       sourceURL: "https://www.sunset.com/wp-content/uploads/96006df453533f4c982212b8cc7882f5-800x0-c-default.jpg"
 *     }
 *   }]
 * }];
 */
export default class MediaContent extends BaseContent {
  constructor(properties?: MediaContentProperties);
  /**
   * Index of the current active media within the popup's media content. This will be the media
   * that is currently viewed when displayed.
   *
   * @since 4.19
   */
  accessor activeMediaInfoIndex: number | null | undefined;
  /**
   * Describes the media's content in detail. Starting at version 4.30, the `description` supports rendering HTML.
   *
   * @since 4.19
   */
  accessor description: string | null | undefined;
  /**
   * Contains the media elements representing images or charts to display
   * within the [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). This can be an individual
   * chart or image element, or an array containing a combination of any of
   * these types.
   */
  get mediaInfos(): PopupContentMediaInfoUnion[] | null | undefined;
  set mediaInfos(value: ((BarChartMediaInfoProperties & { type: "bar-chart" }) | (ColumnChartMediaInfoProperties & { type: "column-chart" }) | (ImageMediaInfoProperties & { type: "image" }) | (LineChartMediaInfoProperties & { type: "line-chart" }) | (PieChartMediaInfoProperties & { type: "pie-chart" }))[] | null | undefined);
  /**
   * Heading indicating what the media's content represents. Starting at version 4.30, the `title` supports rendering HTML.
   *
   * @since 4.19
   */
  accessor title: string | null | undefined;
  /**
   * The type of popup element displayed.
   *
   * @default "media"
   * @see [TextContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-TextContent.html)
   * @see [FieldsContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-FieldsContent.html)
   * @see [MediaContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-MediaContent.html)
   * @see [AttachmentsContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-AttachmentsContent.html)
   * @see [CustomContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-CustomContent.html)
   * @see [ExpressionContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-ExpressionContent.html)
   * @see [RelationshipContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-RelationshipContent.html)
   * @see [UtilityNetworkAssociationsContent](https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-UtilityNetworkAssociationsContent.html)
   */
  get type(): "media";
  /**
   * Creates a deep clone of the MediaContent class.
   *
   * @returns A deep clone of the MediaContent instance.
   */
  clone(): MediaContent;
}