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

export interface TextContentProperties extends BaseContentProperties, Partial<Pick<TextContent, "text">> {}

/**
 * A `TextContent` popup element is used to define descriptive text as an element within a [PopupTemplate's](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/)
 * content. The text may reference values returned from a field attribute or an
 * [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expression defined in a PopupTemplate's [PopupTemplate.expressionInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#expressionInfos) property.
 *
 * ![popuptemplate-text-element](https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/popup/popuptemplate-text-element.png).
 *
 * @since 4.11
 * @see [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/)
 * @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/)
 * @see [Sample - PopupTemplate function](https://developers.arcgis.com/javascript/latest/sample-code/popuptemplate-function/)
 * @see [Sample - PopupTemplate with promise](https://developers.arcgis.com/javascript/latest/sample-code/popuptemplate-promise/)
 * @example
 * // Create the Text Content Element
 * // This element uses an attribute from the featurelayer which displays a sentence
 * // giving the total amount of trees value within a specified census block.
 * let textElement = new TextContent();
 * textElement.text = "There are {Point_Count} trees within census block {BLOCKCE10}";
 *
 * // // Create the PopupTemplate
 * let template = new PopupTemplate({
 *   title: "Beverly Hills trees by block",
 *   outFields: ["*"],
 *   content: [textElement]
 * });
 * @example
 * layer.popupTemplate = {
 *   content: [{
 *     type: "text", // Autocasts as new TextContent
 *     text: "The {expression/predominance-tree} species occurs more often"
 *       + " than other tree species in the area."
 *   }]
 * };
 */
export default class TextContent extends BaseContent {
  constructor(properties?: TextContentProperties);
  /**
   * The formatted string content to display. This may contain a field
   * name enclosed in `{}` (e.g. `{FIELDNAME}`), or an [Arcade](https://developers.arcgis.com/javascript/latest/arcade/)
   * expression [ExpressionInfo.name](https://developers.arcgis.com/javascript/latest/references/core/popup/ExpressionInfo/#name) (e.g. `{expression/EXPRESSIONNAME}`).
   * Text content may also leverage HTML tags such as `<b></b>`,
   * `<p></p>`, and `<table></table>` for formatting the look and feel
   * of the content.
   *
   * > [!WARNING]
   * >
   * > Set the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#fieldInfos) property for any
   * > fields that need to have number formatting within the text.
   *
   * @see [PopupTemplate.expressionInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#expressionInfos)
   */
  accessor text: string | null | undefined;
  /**
   * The type of popup element displayed.
   *
   * @default "text"
   * @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(): "text";
  /**
   * Creates a deep clone of the TextContent class.
   *
   * @returns A deep clone of the TextContent instance.
   */
  clone(): TextContent;
}