import type { JSONSupport } from "../../core/JSONSupport.js";

export interface FieldIndexProperties extends Partial<Pick<FieldIndex, "ascending" | "fieldNames" | "name" | "unique">> {}

/**
 * Defines an index on fields associated with an [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/).
 * The results from [executeSearch()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeSearch) on a knowledge graph service will include content from indexed text and [GUID](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/arcgis-field-data-types.htm#GUID-97064FAE-B42E-4DC3-A5C9-9A6F12D053A8) fields.
 *
 * @since 4.25
 * @example
 * //example of a field index on the `name` field
 * "fieldIndexes": [
 *   {
 *     "declaredClass": "esri.rest.knowledgeGraph.FieldIndex",
 *     "name": "esri__name_idx",
 *     "unique": true,
 *     "ascending": true,
 *     "description": "index on name field",
 *     "fieldNames": [
 *       "name"
 *     ]
 *   }
 * ]
 */
export default class FieldIndex extends JSONSupport {
  constructor(properties?: FieldIndexProperties);
  /**
   * Specifies if the field is indexed in ascending order.
   * If `false` the field is indexed in descending order.
   *
   * @default true
   */
  accessor ascending: boolean;
  /**
   * Description of the field.
   *
   * @default ""
   */
  get description(): string;
  /** The ordered field names included in this index. */
  accessor fieldNames: string[];
  /** The name of the field. */
  accessor name: string;
  /** Specifies if the values in the field are unique (no duplicate values). */
  accessor unique: boolean;
}