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

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

/**
 * Defines an index on fields associated with an [entity type](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-EntityType.html) or [relationship type](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-RelationshipType.html).
 * The results from [executeSearch()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html#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;
}