import type CodedValueDomain from "../../../layers/support/CodedValueDomain.js";
import type RangeDomain from "../../../layers/support/RangeDomain.js";
import type ColumnTemplateBase from "./ColumnTemplateBase.js";
import type { ColumnTemplateBaseProperties } from "./ColumnTemplateBase.js";
import type { EditableColumnTemplateMixinProperties, EditableColumnTemplateMixin } from "./EditableColumnTemplateMixin.js";
import type { FieldValueFormatFunction } from "./types.js";
import type { RangeDomainProperties } from "../../../layers/support/RangeDomain.js";
import type { CodedValueDomainProperties } from "../../../layers/support/CodedValueDomain.js";

export interface FieldColumnTemplateProperties extends ColumnTemplateBaseProperties, EditableColumnTemplateMixinProperties {
  /** The [coded value domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/CodedValueDomain/) or a [range domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/RangeDomain/) of the associated field. */
  domain?: (CodedValueDomainProperties & { type: "coded-value" }) | (RangeDomainProperties & { type: "range" }) | null;
  /**
   * Custom function for rendering cell content. Accepts a string, number, an HTML element or equivalent node type (e.g. a Calcite component).
   *
   * @since 4.30
   * @example
   * // The following example demonstrates how to use the formatFunction property to create a custom cell renderer that displays a progress bar in the cell. The progress bar can be used to show the progress of a task.
   * columnTemplate.formatFunction = ({ column, feature, index, value })=> {
   *   const progress = document.createElement("progress");
   *   progress.max = 100;
   *   progress.value = value;
   *   return progress;
   * };
   */
  formatFunction?: FieldValueFormatFunction | null;
  /**
   * Indicates whether the field column can be sorted.
   *
   * @default true
   */
  sortable?: boolean;
}

/**
 * A FieldColumnTemplate formats and defines the structure of a [FieldColumn](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FieldColumn/) within a
 * [FeatureTable](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/) widget.
 *
 * The FieldColumnTemplate is set directly on the table's [template](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) or its [view model](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#tableTemplate).
 * The [FeatureTable's tableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) contains a collection of [field and/or group column templates](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/#columnTemplates).
 *
 * @since 4.24
 * @see [FeatureTable](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/)
 * @see [TableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/)
 * @see [GroupColumnTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/GroupColumnTemplate/)
 * @see [Sample - FeatureTable with a map](https://developers.arcgis.com/javascript/latest/sample-code/widgets-featuretable-map/)
 * @see [Sample - FeatureTable with related records](https://developers.arcgis.com/javascript/latest/sample-code/widgets-featuretable-relates/)
 * @see [Sample - FeatureTable with row highlights](https://developers.arcgis.com/javascript/latest/sample-code/widgets-featuretable-row-highlights/)
 * @example
 * const fieldColumnTemplate = new FieldColumnTemplate({
 *   fieldName: "full_name",
 *   label: "Full name",
 *   direction: "asc", // In order to use initialSortPriority, make sure direction is set
 *   initialSortPriority: 0 // This field's sort order takes the highest priority.
 * });
 */
export default class FieldColumnTemplate extends FieldColumnTemplateSuperclass {
  constructor(properties?: FieldColumnTemplateProperties);
  /** The [coded value domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/CodedValueDomain/) or a [range domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/RangeDomain/) of the associated field. */
  get domain(): CodedValueDomain | RangeDomain | null | undefined;
  set domain(value: (CodedValueDomainProperties & { type: "coded-value" }) | (RangeDomainProperties & { type: "range" }) | null | undefined);
  /**
   * Custom function for rendering cell content. Accepts a string, number, an HTML element or equivalent node type (e.g. a Calcite component).
   *
   * @since 4.30
   * @example
   * // The following example demonstrates how to use the formatFunction property to create a custom cell renderer that displays a progress bar in the cell. The progress bar can be used to show the progress of a task.
   * columnTemplate.formatFunction = ({ column, feature, index, value })=> {
   *   const progress = document.createElement("progress");
   *   progress.max = 100;
   *   progress.value = value;
   *   return progress;
   * };
   */
  accessor formatFunction: FieldValueFormatFunction | null | undefined;
  /**
   * Indicates whether the field column can be sorted.
   *
   * @default true
   */
  accessor sortable: boolean;
  /**
   * The type of column that the template represents.
   *
   * > [!WARNING]
   * >
   * > This property must be set to `field` when creating a new FieldColumnTemplate within a [TableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/).
   */
  get type(): "field";
}
declare const FieldColumnTemplateSuperclass: typeof ColumnTemplateBase & typeof EditableColumnTemplateMixin