import type FieldInfo from "../FieldInfo.js";
import type BaseContent from "./Content.js";
import type { FieldInfoProperties } from "../FieldInfo.js";
import type { ContentProperties as BaseContentProperties } from "./Content.js";

export interface FieldsContentProperties extends BaseContentProperties, Partial<Pick<FieldsContent, "description" | "title">> {
  /**
   * Array of [fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/popup/FieldInfo/).
   * `FieldInfos` set within the `FieldsContent` take precedence over the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#fieldInfos).
   * If the `fieldInfos` property is not provided directly within the content, the popup will display whatever is set in the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#fieldInfos).
   */
  fieldInfos?: FieldInfoProperties[] | null;
}

/**
 * A `FieldsContent` popup element represents the [FieldInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/FieldInfo/) associated with a
 * feature. If the [fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/popup/content/FieldsContent/#fieldInfos) is not set,
 * it will revert to whatever may be set within the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#fieldInfos)
 * property.
 *
 * ![popuptemplate-fields-element](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/popup/popuptemplate-fields-element.png)
 *
 * @since 4.11
 * @see [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/)
 * @see [FieldInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/FieldInfo/)
 * @see [Content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/Content/)
 * @see [ExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/ExpressionInfo/)
 * @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/)
 * @example
 * // Create the FieldsInfo for the FieldsContent popup element
 * // Field Info 1
 * let fieldInfo1 = new FieldInfo({
 *   fieldName: "relationships/0/Point_Count_COMMON", // using a related table's field
 *   label: "Sum of species tree count",
 *   visible: true,
 *   format: format: {
 *     digitSeparator: true,
 *     places: 0
 *   },
 *   statisticType: "sum"
 * });
 *
 * // Field Info 2
 * let fieldInfo2 = new FieldInfo({
 *   fieldName: "BLOCKCE10",
 *   label: "Block",
 *   visible: true
 * });
 *
 * // Create the FieldsContent element
 * let fieldsElement = new FieldsContent({
 *   fieldInfos: [fieldInfo1, fieldInfo2]
 * });
 */
export default class FieldsContent extends BaseContent {
  constructor(properties?: FieldsContentProperties);
  /**
   * Describes the field's content in detail. Starting at version 4.30, the `description` supports rendering HTML.
   *
   * @since 4.19
   */
  accessor description: string | null | undefined;
  /**
   * Array of [fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/popup/FieldInfo/).
   * `FieldInfos` set within the `FieldsContent` take precedence over the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#fieldInfos).
   * If the `fieldInfos` property is not provided directly within the content, the popup will display whatever is set in the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#fieldInfos).
   */
  get fieldInfos(): FieldInfo[] | null | undefined;
  set fieldInfos(value: FieldInfoProperties[] | null | undefined);
  /**
   * Heading indicating what the field'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 "fields"
   * @see [TextContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/TextContent/)
   * @see [FieldsContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/FieldsContent/)
   * @see [MediaContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/MediaContent/)
   * @see [AttachmentsContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/AttachmentsContent/)
   * @see [CustomContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/CustomContent/)
   * @see [ExpressionContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/ExpressionContent/)
   * @see [RelationshipContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/RelationshipContent/)
   * @see [UtilityNetworkAssociationsContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/UtilityNetworkAssociationsContent/)
   */
  get type(): "fields";
  /**
   * Creates a deep clone of the FieldsContent class.
   *
   * @returns A deep clone of the FieldsContent instance.
   */
  clone(): FieldsContent;
}