import type FieldIndex from "./FieldIndex.js";
import type GraphProperty from "./GraphProperty.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { GraphPropertyProperties } from "./GraphProperty.js";
import type { FieldIndexProperties } from "./FieldIndex.js";

export interface GraphObjectTypeProperties extends Partial<Pick<GraphObjectType, "alias" | "name" | "role">> {
  /** Specifies [index fields](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/FieldIndex/) for a graph object type. [executeSearch()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeSearch) will include content from indexed text and [GUID](https://doc.esri.com/en/arcgis-pro/latest/help/data/geodatabases/overview/arcgis-field-data-types.html#GUID-97064FAE-B42E-4DC3-A5C9-9A6F12D053A8) fields. */
  fieldIndexes?: FieldIndexProperties[];
  /** Specifies the [properties](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphProperty/) of a graph object type such as an [EntityType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or [RelationshipType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/). */
  properties?: GraphPropertyProperties[];
}

/**
 * Parent object for [entity types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) and [relationship types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/) defined in the graph schema.
 *
 * @since 4.25
 * @see [EntityType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/)
 * @see [RelationshipType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/)
 * @example
 * //sample structure of an entity type
 * {
 *  "declaredClass": "esri.rest.knowledgeGraph.EntityType",
 *  "name": "company",
 *  "alias": "Company",
 *  "role": "Regular",
 *  "strict": false,
 *  "properties": [
 *    {
 *      "declaredClass": "esri.rest.knowledgeGraph.GraphProperty",
 *      "name": "Name",
 *      "alias": "Name",
 *      "fieldType": "esriFieldTypeString",
 *      "geometryType": "esriGeometryNull",
 *      "hasM": false,
 *      "hasZ": false,
 *      "nullable": true,
 *      "editable": true,
 *      "required": false,
 *      "defaultVisibility": true,
 *      "systemMaintained": false,
 *      "role": "esriGraphPropertyRegular",
 *      "defaultValue": null
 *    },
 *    {
 *      "declaredClass": "esri.rest.knowledgeGraph.GraphProperty",
 *      "name": "id",
 *      "alias": "id",
 *      "fieldType": "esriFieldTypeOID",
 *      "geometryType": "esriGeometryNull",
 *      "hasM": false,
 *      "hasZ": false,
 *      "nullable": false,
 *      "editable": false,
 *      "required": true,
 *      "defaultVisibility": true,
 *      "systemMaintained": true,
 *      "role": "esriGraphPropertyRegular",
 *      "defaultValue": null
 *    }
 *  ],
 *  "fieldIndexes": [
 *    {
 *      "declaredClass": "esri.rest.knowledgeGraph.FieldIndex",
 *      "name": "esri__id_idx",
 *      "unique": true,
 *      "ascending": true,
 *      "description": "",
 *      "fieldNames": [
 *        "id"
 *      ]
 *    },
 *    {
 *      "declaredClass": "esri.rest.knowledgeGraph.FieldIndex",
 *      "name": "esri__name_idx",
 *      "unique": true,
 *      "ascending": true,
 *      "description": "",
 *      "fieldNames": [
 *        "name"
 *      ]
 *    }
 *  ]
 * }
 */
export default class GraphObjectType extends JSONSupport {
  constructor(properties?: GraphObjectTypeProperties);
  /** - The display name of the graph object type that can be updated. */
  accessor alias: string | null | undefined;
  /** Specifies [index fields](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/FieldIndex/) for a graph object type. [executeSearch()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeSearch) will include content from indexed text and [GUID](https://doc.esri.com/en/arcgis-pro/latest/help/data/geodatabases/overview/arcgis-field-data-types.html#GUID-97064FAE-B42E-4DC3-A5C9-9A6F12D053A8) fields. */
  get fieldIndexes(): FieldIndex[];
  set fieldIndexes(value: FieldIndexProperties[]);
  /** The name of the graph object type. */
  accessor name: string;
  /** Specifies the [properties](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphProperty/) of a graph object type such as an [EntityType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) or [RelationshipType](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/). */
  get properties(): GraphProperty[];
  set properties(value: GraphPropertyProperties[]);
  /**
   * The object type's role in the knowledge graph. Designates objects that have capabilities that are not available to other objects.
   * For example, the document entity type has a specific role of 'Document'. The `Document` entity type (and the associated `HasDocument` relationship) are included in all knowledge graph services by default.
   *
   * @default "Regular"
   */
  accessor role: NamedObjectType;
}

/** @since 5.0 */
export type NamedObjectType = "Regular" | "Provenance" | "Document";