import type { ClonableMixin, ClonableMixinProperties } from "../../../core/Clonable.js";
import type { JSONSupport, JSONSupportMixinProperties } from "../../../core/JSONSupport.js";
import type { AttachmentsColumnTemplateProperties } from "./AttachmentsColumnTemplate.js";
import type { ColumnTemplateProperties } from "./ColumnTemplate.js";
import type { FieldColumnTemplateProperties } from "./FieldColumnTemplate.js";
import type { GroupColumnTemplateProperties } from "./GroupColumnTemplate.js";
import type { RelationshipColumnTemplateProperties } from "./RelationshipColumnTemplate.js";
import type { SupportedColumnTemplates } from "./types.js";

export interface TableTemplateProperties extends JSONSupportMixinProperties, ClonableMixinProperties {
  /**
   * A collection of [field column templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-FieldColumnTemplate.html) and/or [group column templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-GroupColumnTemplate.html) that represent an ordered list of column templates.
   *
   * Column templates are designed to allow the developer the ability to
   * define the structure for columns within the [FeatureTable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html) widget.
   *
   * @see [FieldColumnTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-FieldColumnTemplate.html)
   * @see [GroupColumnTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-GroupColumnTemplate.html)
   * @example
   * const tableTemplate = new TableTemplate({
   *   columnTemplates: [
   *   { // autocasts to FieldColumnTemplate
   *     type: "field",
   *     fieldName: "ObjectId",
   *     direction: "asc",
   *     initialSortPriority: 1 // This field's sort order takes the second-highest priority.
   *   },
   *   {
   *     type: "field",
   *     fieldName: "NAME",
   *     label: "Name",
   *     initialSortPriority: 0 // This field's sort order takes the highest priority
   *   },
   *   {
   *     type: "field",
   *     fieldName: "STATUS",
   *     label: "Status",
   *     direction: "asc",
   *     initialSortPriority: 2 // This field's sort order is prioritized after Name and ObjectId, respectively.
   *   }]
   * });
   */
  columnTemplates?: ((FieldColumnTemplateProperties & {
      type: "field";
  }) | (GroupColumnTemplateProperties & {
      type: "group";
  }) | (ColumnTemplateProperties & {
      type: "column";
  }) | (AttachmentsColumnTemplateProperties & {
      type: "attachment";
  }) | (RelationshipColumnTemplateProperties & {
      type: "relationship";
  }))[];
}

/**
 * A TableTemplate formats and defines the content of a [FeatureTable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html).
 *
 * The TableTemplate can be set directly on a [FeatureTable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html) or its [view model](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-FeatureTableViewModel.html). The template consists of various [column templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-TableTemplate.html#columnTemplates) that can be configured for both [individual fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-FieldColumnTemplate.html) and [grouped fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-GroupColumnTemplate.html).
 *
 * > [!WARNING]
 * >
 * > **Considerations**
 * >
 * > This class differs from [AttributeTableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-AttributeTableTemplate.html). The `TableTemplate`
 * > provides more fine-grained control over how the table is rendered within the application by
 * > offering more advanced configurations such as custom cell rendering, column formatting, and more.
 * > `TableTemplate` is useful for application-level development that remains within an application.
 * > Use [AttributeTableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-AttributeTableTemplate.html) to access the table's settings across
 * > different applications. By using this, the table's column settings can be saved within a webmap
 * > or layer. Please refer to the [AttributeTableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-AttributeTableTemplate.html) documentation
 * > for more information.
 * >
 * > The [FeatureTable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html) prioritizes the table's configurations in the following order:
 * >
 * > 1. The [TableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-TableTemplate.html) defined in the FeatureTable.
 * > 2. The [FeatureTable#attributeTableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html#attributeTableTemplate)  defined in the FeatureTable.
 * > 3. The [AttributeTableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-tables-AttributeTableTemplate.html) defined in the layer or standalone table.
 * > 4. Default columns are generated based on the layer's fields if no table templates exist.
 *
 * @since 4.24
 * @example
 * const tableTemplate = new TableTemplate({
 *   columnTemplates: [ // takes an array of FieldColumnTemplate and GroupColumnTemplate
 *   { // autocasts to FieldColumnTemplate
 *     type: "field",
 *     fieldName: "ObjectId",
 *     direction: "asc", // In order to use initialSortPriority, make sure direction is set
 *     initialSortPriority: 1 // This field's sort order takes the second-highest priority.
 *   },
 *   {
 *     type: "field",
 *     fieldName: "NAME",
 *     label: "Name",
 *     direction: "asc", // In order to use initialSortPriority, make sure direction is set
 *     initialSortPriority: 0 // This field's sort order takes the highest priority
 *   },
 *   {
 *     type: "field",
 *     fieldName: "STATUS",
 *     label: "Status",
 *     direction: "asc", // In order to use initialSortPriority, make sure direction is set
 *     initialSortPriority: 2 // This field's sort order is prioritized after Name and ObjectId, respectively.
 *   }]
 * });
 */
export default class TableTemplate extends TableTemplateSuperclass {
  constructor(properties?: TableTemplateProperties);
  /**
   * A collection of [field column templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-FieldColumnTemplate.html) and/or [group column templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-GroupColumnTemplate.html) that represent an ordered list of column templates.
   *
   * Column templates are designed to allow the developer the ability to
   * define the structure for columns within the [FeatureTable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html) widget.
   *
   * @see [FieldColumnTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-FieldColumnTemplate.html)
   * @see [GroupColumnTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-GroupColumnTemplate.html)
   * @example
   * const tableTemplate = new TableTemplate({
   *   columnTemplates: [
   *   { // autocasts to FieldColumnTemplate
   *     type: "field",
   *     fieldName: "ObjectId",
   *     direction: "asc",
   *     initialSortPriority: 1 // This field's sort order takes the second-highest priority.
   *   },
   *   {
   *     type: "field",
   *     fieldName: "NAME",
   *     label: "Name",
   *     initialSortPriority: 0 // This field's sort order takes the highest priority
   *   },
   *   {
   *     type: "field",
   *     fieldName: "STATUS",
   *     label: "Status",
   *     direction: "asc",
   *     initialSortPriority: 2 // This field's sort order is prioritized after Name and ObjectId, respectively.
   *   }]
   * });
   */
  get columnTemplates(): SupportedColumnTemplates[];
  set columnTemplates(value: ((FieldColumnTemplateProperties & {
      type: "field";
  }) | (GroupColumnTemplateProperties & {
      type: "group";
  }) | (ColumnTemplateProperties & {
      type: "column";
  }) | (AttachmentsColumnTemplateProperties & {
      type: "attachment";
  }) | (RelationshipColumnTemplateProperties & {
      type: "relationship";
  }))[]);
}
declare const TableTemplateSuperclass: typeof JSONSupport & typeof ClonableMixin