import type Multipoint from "../../geometry/Multipoint.js";
import type Point from "../../geometry/Point.js";
import type Polygon from "../../geometry/Polygon.js";
import type Polyline from "../../geometry/Polyline.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { EsriFieldType, EsriGeometryType, EsriGraphPropertyRoles } from "./types.js";

export interface GraphPropertyProperties extends Partial<Pick<GraphProperty, "alias" | "defaultValue" | "defaultVisibility" | "domain" | "editable" | "fieldType" | "geometryType" | "hasM" | "hasZ" | "name" | "nullable" | "required" | "role" | "systemMaintained">> {}

/**
 * Specifies the properties 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 by the [data model](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/DataModel/).
 * Each instance of a specified graph object type will include these properties.
 *
 * @since 4.25
 * @example
 * //The `EntityType`  'person' may have the following properties.
 * [{
 *   name: "first_name"
 *   alias: "First Name",
 *   defaultValue: null,
 *   defaultVisibility: true,
 *   editable: true,
 *   fieldType: "esriFieldTypeString",
 *   geometryType: "esriGeometryNull",
 *   hasM: false,
 *   hasZ: false,
 *   nullable: true,
 *   required: false,
 *   searchable: false,
 *   systemMaintained: false
 * },
 * {
 *   name: "age",
 *   alias: "Age",
 *   defaultValue: null,
 *   defaultVisibility: true,
 *   editable: true,
 *   fieldType: "esriFieldTypeNumber",
 *   geometryType: "esriGeometryNull",
 *   hasM: false,
 *   hasZ: false,
 *   nullable: false,
 *   required: false,
 *   searchable: true,
 *   systemMaintained: false
 * }]
 * @example
 * //example of a RelationshipType definition including properties.
 * {
 *   "declaredClass": "esri.rest.knowledgeGraph.RelationshipType",
 *   "name": "employed_by",
 *   "alias": "Employed By",
 *   "role": "Regular",
 *   "strict": false,
 *   "properties": [{
 *     "declaredClass": "esri.rest.knowledgeGraph.GraphProperty",
 *     "name": "id",
 *     "alias": "id",
 *     "fieldType": "esriFieldTypeGUID",
 *     "geometryType": "esriGeometryNull",
 *     "hasM": false,
 *     "hasZ": false,
 *     "nullable": false,
 *     "editable": false,
 *     "required": true,
 *     "defaultVisibility": true,
 *     "systemMaintained": true,
 *     "role": "esriGraphPropertyRegular",
 *     "defaultValue": null
 *   },
 *   {
 *     "declaredClass": "esri.rest.knowledgeGraph.GraphProperty",
 *     "name": "start_date",
 *     "alias": "Start Date",
 *     "fieldType": "esriFieldTypeString",
 *     "geometryType": "esriGeometryNull",
 *     "hasM": false,
 *     "hasZ": false,
 *     "nullable": false,
 *     "editable": true,
 *     "required": true,
 *     "defaultVisibility": true,
 *     "systemMaintained": false,
 *     "role": "esriGraphPropertyRegular",
 *     "defaultValue": null
 *   }]
 * }
 */
export default class GraphProperty extends JSONSupport {
  constructor(properties?: GraphPropertyProperties);
  /** The display name for the property. */
  accessor alias: string | null | undefined;
  /** Specifies a default value for the object type. */
  accessor defaultValue: string | Date | number | Point | Multipoint | Polyline | Polygon | null;
  /**
   * Specifies whether the property is visible by default.
   *
   * @default true
   */
  accessor defaultVisibility: boolean;
  /** The name of the domain for values of this property, if applicable */
  accessor domain: string | null | undefined;
  /**
   * Specifies whether the property is editable.
   *
   * @default true
   */
  accessor editable: boolean;
  /**
   * Specifies the field type for the property.
   *
   * @example
   * // possible field types
   * "esriFieldTypeSmallInteger"
   * "esriFieldTypeInteger"
   * "esriFieldTypeSingle"
   * "esriFieldTypeDouble"
   * "esriFieldTypeLong"
   * "esriFieldTypeString"
   * "esriFieldTypeDate"
   * "esriFieldTypeOID"
   * "esriFieldTypeGeometry"
   * "esriFieldTypeBlob"
   * "esriFieldTypeRaster"
   * "esriFieldTypeGUID"
   * "esriFieldTypeGlobalID"
   * "esriFieldTypeXML"
   * "esriFieldTypeBigInteger"
   * "esriFieldTypeTimestampOffset"
   * "esriFieldTypeTimeOnly"
   * "esriFieldTypeDateOnly"
   */
  accessor fieldType: EsriFieldType;
  /** Specifies the geometry type for the property. Will not be present if property is not of type `geometry`. */
  accessor geometryType: EsriGeometryType | null | undefined;
  /** Specifies whether the property has an m-value. This only applies if the property is of type `geometry`. */
  accessor hasM: boolean | null | undefined;
  /** Specifies whether property has a z-value. This only applies if the property is of type `geometry`. */
  accessor hasZ: boolean | null | undefined;
  /** The name of the property. */
  accessor name: string;
  /**
   * Specifies whether the property can be `null`.
   *
   * @default true
   */
  accessor nullable: boolean | null | undefined;
  /**
   * Specifies whether the property is required.
   *
   * @default false
   */
  accessor required: boolean;
  /**
   * Specifies the role of the property. [Entity types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) with the [GraphObjectType.role](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphObjectType/#role) `document` have properties with specific roles.
   *
   * @default "esriGraphPropertyUNSPECIFIED"
   * @example
   * {
   * 	"declaredClass": "esri.rest.knowledgeGraph.EntityType",
   * 	"name": "documents",
   * 	"alias": "Documents",
   * 	"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": "esriGraphPropertyDocumentName",
   * 			"defaultValue": null
   * 		},
   * 		{
   * 			"declaredClass": "esri.rest.knowledgeGraph.GraphProperty",
   * 			"name": "text",
   * 			"alias": "text",
   * 			"fieldType": "esriFieldTypeString",d
   * 			"geometryType": "esriGeometryNull",
   * 			"hasM": false,
   * 			"hasZ": false,
   * 			"nullable": false,
   * 			"editable": false,
   * 			"required": true,
   * 			"defaultVisibility": true,
   * 			"systemMaintained": true,
   * 			"role": "esriGraphPropertyDocumentText",
   * 			"defaultValue": null
   * 		}
   * 	]
   * }
   */
  accessor role: EsriGraphPropertyRoles;
  /** Specifies if the property is system maintained. */
  accessor systemMaintained: boolean | null | undefined;
}