import type ColumnTemplateBase from "./ColumnTemplateBase.js";
import type { AttachmentsColumnTemplateProperties } from "./AttachmentsColumnTemplate.js";
import type { ColumnTemplateProperties } from "./ColumnTemplate.js";
import type { ColumnTemplateBaseProperties } from "./ColumnTemplateBase.js";
import type { FieldColumnTemplateProperties } from "./FieldColumnTemplate.js";
import type { RelationshipColumnTemplateProperties } from "./RelationshipColumnTemplate.js";
import type { GroupColumnSupportedTemplates } from "./types.js";

export interface GroupColumnTemplateProperties extends ColumnTemplateBaseProperties {
  /**
   * 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 [TableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-TableTemplate.html)
   * @example
   * // Create a new table template
   * const tableTemplate = new TableTemplate({
   *   columnTemplates: [{ // Autocasts to new GroupColumnTemplate
   *     type: "group",
   *     label: "Inspector information",
   *     columnTemplates: [{
   *       // Autocasts to new FieldColumnTemplate
   *       type: "field",
   *       fieldName: "inspector",
   *       label: "name"
   *     },{
   *       type: "field",
   *       fieldName: "inspemail",
   *       label: "Email address"
   *     },{
   *       type: "field",
   *       fieldName: "insp_date",
   *       label: "Date of inspection"
   *     }]
   *   }]
   * });
   */
  columnTemplates?: ((FieldColumnTemplateProperties & {
      type: "field";
  }) | (ColumnTemplateProperties & {
      type: "column";
  }) | (AttachmentsColumnTemplateProperties & {
      type: "attachment";
  }) | (RelationshipColumnTemplateProperties & {
      type: "relationship";
  }))[];
}

/**
 * A GroupColumnTemplate formats and defines the structure of a [GroupColumn](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-Grid-GroupColumn.html) within a
 * [FeatureTable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html) widget.
 *
 * The GroupColumnTemplate is set directly on the table's [template](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-TableTemplate.html) or its [view model](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-FeatureTableViewModel.html#tableTemplate).
 * The FeatureTable's [TableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-TableTemplate.html) contains a collection of [field/group column templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-TableTemplate.html#columnTemplates).
 *
 * @since 4.24
 * @see [FeatureTable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html)
 * @see [TableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-TableTemplate.html)
 * @see [FieldColumnTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-FieldColumnTemplate.html)
 * @see [Sample - FeatureTable widget with editing enabled](https://developers.arcgis.com/javascript/latest/sample-code/widgets-featuretable-editing/)
 * @example
 * const groupColumnTemplate = new GroupColumnTemplate({
 *   fieldName: "full_name",
 *   label: "Full name"
 * });
 */
export default class GroupColumnTemplate extends ColumnTemplateBase {
  constructor(properties?: GroupColumnTemplateProperties);
  /**
   * 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 [TableTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable-support-TableTemplate.html)
   * @example
   * // Create a new table template
   * const tableTemplate = new TableTemplate({
   *   columnTemplates: [{ // Autocasts to new GroupColumnTemplate
   *     type: "group",
   *     label: "Inspector information",
   *     columnTemplates: [{
   *       // Autocasts to new FieldColumnTemplate
   *       type: "field",
   *       fieldName: "inspector",
   *       label: "name"
   *     },{
   *       type: "field",
   *       fieldName: "inspemail",
   *       label: "Email address"
   *     },{
   *       type: "field",
   *       fieldName: "insp_date",
   *       label: "Date of inspection"
   *     }]
   *   }]
   * });
   */
  get columnTemplates(): GroupColumnSupportedTemplates[];
  set columnTemplates(value: ((FieldColumnTemplateProperties & {
      type: "field";
  }) | (ColumnTemplateProperties & {
      type: "column";
  }) | (AttachmentsColumnTemplateProperties & {
      type: "attachment";
  }) | (RelationshipColumnTemplateProperties & {
      type: "relationship";
  }))[]);
  /** The type of column that the template represents. */
  get type(): "group";
}