import type Collection from "../core/Collection.js";
import type Layer from "./Layer.js";
import type KnowledgeGraphSublayer from "./knowledgeGraph/KnowledgeGraphSublayer.js";
import type LayoutSettings from "../linkChart/LayoutSettings.js";
import type EntityType from "../rest/knowledgeGraph/EntityType.js";
import type RelationshipType from "../rest/knowledgeGraph/RelationshipType.js";
import type { InclusionListDefinitionConstructor } from "./knowledgeGraph/KnowledgeGraphLayerDataManager.js";
import type { LayoutMode } from "./knowledgeGraph/LayoutMode.js";
import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js";
import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js";
import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js";
import type { LayerProperties } from "./Layer.js";

export interface LinkChartLayerProperties extends LayerProperties, ScaleRangeLayerProperties, BlendLayerProperties, OperationalLayerProperties, Partial<Pick<LinkChartLayer, "initializationInclusionModeDefinition" | "initializationLinkChartConfig" | "memberEntityTypes" | "memberRelationshipTypes" | "url">> {
  /** An optional title for the LinkChartLayer. */
  title?: string | null;
}

/** Defines the initial layout for the link chart and any layout settings for newly created link chart layers. */
export interface InitializationLinkChartConfig {
  /**
   * By default, the layout algorithm always runs on link charts when they are first created.
   * If all diagram locations are set for every entity in the inclusion definition, this property can be set to `true` which skips the layout algorithm step and increases the performance of larger link charts.
   */
  doNotRecalculateLayout?: boolean;
  /** The layout mode to be applied by default. The system default is `organic-standard`. */
  layoutMode?: LayoutMode;
  /** Additional layout options for the default layout configuration. */
  layoutSettings?: LayoutSettings;
}

/**
 * A LinkChartLayer is a composite layer that can be created from a
 * [knowledge graph service](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html).
 * The layer contains [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-LinkChartLayer.html#layers) for each  [entity type](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-EntityType.html)
 * and [relationship type](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-RelationshipType.html) contained in the LinkChartLayer.
 *
 * Entity and relationship types have [geometries](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html)
 * that allows them to be rendered in a LinkChartView or as a
 * [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) with spatial context. They also contain data
 * [Graphic#attributes](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#attributes) that provide additional information about
 * the real-world feature it represents; Attributes may be viewed in [popups](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html#popupTemplate)
 * and used for [rendering](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) the layer.
 * Sublayers may be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html#queryFeatures), [analyzed](https://developers.arcgis.com/javascript/latest/spatial-analysis/intro-geometry-operators/),
 * and [rendered](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html#renderer) to visualize data in a spatial context.
 *
 *
 * > [!WARNING]
 * >
 * > **Implementation Note**
 * >
 * > Link chart layers are not dynamic. If no inclusion definition is specified, the inclusion definition will be defined as all records
 * > in the graph at the time of layer creation. If a named type is specified with no explicit members, then all records of that named
 * > type will be defined as the inclusion definition. Any data added to the graph or named type after this point will not be included in
 * > the link chart.
 *
 *
 * ### Create Link Chart Layer
 *
 * To create a LinkChartLayer from [knowledgeGraphService](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html), you must set the [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-LinkChartLayer.html#url) property
 * to the REST endpoint of the service. For a layer to be visible in a view, it must be added to the WebLinkChart
 * referenced by the view. See [WebLinkChart](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html) for information about adding layers to a WebLinkChart.
 *
 * ```js
 * const [LinkChartLayer, WebLinkChart, LinkChartView] = await $arcgis.import([
 *   "@arcgis/core/layers/LinkChartLayer.js",
 *   "@arcgis/core/WebLinkChart.js",
 *   "@arcgis/core/LinkChartView.js"
 * ]);
 * const myLinkChartLayer = new LinkChartLayer({
 *   title: "link chart layer",
 *   url: "https://sampleserver7.arcgisonline.com/arcgis/rest/services/Hosted/SmallBumbleBees/KnowledgeGraphServer"
 * });
 * myLinkChartLayer.load().then(()=>{
 *   const linkchart = new WebLinkChart({
 *     layers: [myLinkChartLayer]
 *   });
 * })
 * ```
 *
 * @since 4.31
 * @see [WebLinkChart](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html)
 * @see [KnowledgeGraphSublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html)
 * @see [knowledgeGraphService](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html)
 * @see [KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-KnowledgeGraphLayer.html)
 */
export default class LinkChartLayer extends LinkChartLayerSuperclass {
  constructor(properties?: LinkChartLayerProperties);
  /**
   * Defines a set of [named types](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-GraphNamedObject.html) and/or
   * [entities](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-Entity.html)
   * and [relationships](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-Relationship.html) to be included in the layer.
   * If only a named type is specified, all instances of that type will be included
   * in the layer. [Sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html) can be created for all named types
   * in the graph even if they have no instances specified in the member definition. The inclusion definition is not permanently dynamic.
   * It captures the data at the time of creation. For example, if `generateAllSublayers` is `true` and a new entity type is added to the knowledge graph,
   * that new entity type will not be added to the inclusion list. Similarly, if `useAllData` is `true` for a type, and a new record is added to
   * that type, the newly added record will not be automatically added to the inclusionList.
   *
   * > [!IMPORTANT]
   * >
   * > **Constructor Only**
   * >
   * > This property is only supported when passed to the constructor on the first initialization of a link chart layer.
   * > Use [WebLinkChart#addRecords()](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html#addRecords) and [WebLinkChart#removeRecords()](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html#removeRecords) to change the membership of the layer after initialization.
   *
   * @example
   * // constructing an inclusion list:
   * // The exact record ids of each of the records of a specific named type (entity type or relationship type)
   * // to include in the layer. In this case the layer will contain one record
   * const layerInclusionMemberDefinition = new Map();
   * layerInclusionMemberDefinition.set("{1A4W8G4-W52G-W89G-1W5G-J1R4S8H52H4S}",{id:"{1A4W8G4-W52G-W89G-1W5G-J1R4S8H52H4S}"})
   *
   *  //The layerInclusionDefinition specifies whether to use all of the data in a named type or only the records
   * // specified in the 'members' list. In this case we only want the records specified.
   * const layerInclusionDefinition = {
   *   useAllData: false, //only include instances in the member list
   *   members: layerInclusionMemberDefinition
   * };
   *
   * // The namedTypeDefinition is a map of the typeName of each type to be included.
   * // In this case we are only including the "Observation" entity type.
   * // The layerInclusionDefinition specifies exactly which "Observation" entities to include in the layer.
   * const namedTypeDefinition = new Map();
   * namedTypeDefinition.set("Observation", layerInclusionDefinition);
   *
   * // Specify if a sublayer should be generated for all named types.
   * // If true, a sublayer will be created for all named types regardless of
   * // whether they have a list of instances to include or not.
   * // If there are no instances the sublayer will be empty. In this case we have set 'generateAllSubLayers' to false so the
   * // layer will only contain sublayers for the named types (entity types or relationship types) that are specified
   * // in the namedTypeDefinitions.
   * // Also defines the collection of named types to include in the layer.
   * const inclusionListDefinition = {
   *   generateAllSublayers: false, //only create sublayers for the named types in the namedTypeDefinition
   *   namedTypeDefinitions: namedTypeDefinition
   * }
   * @example
   * //examples of the initializationInclusionModeDefinition structure inside the LinkChartLayer
   *
   * //the layer will only contain one sublayer (for 'supplier') and that sublayer will consist of one entity.
   * {
   *   generateAllSublayers: false,
   *   namedTypeDefinition:[{
   *     key: "supplier",
   *     value:{
   *       useAllData: false,
   *       members: [{
   *         key: "{1A4W8G4-W52G-W89G-1W5G-J1R4S8H52H4S}",
   *         value: {
   *           id: "{1A4W8G4-W52G-W89G-1W5G-J1R4S8H52H4S}",
   *         }
   *       }]
   *     }
   *   }]
   * }
   *
   * // this layer will contain a sublayer for all named types in the graph
   * // ('Observation', 'User', 'Species', "Observed", "Reviewed", "ObservedIn")
   * // but only the 'Observation' sublayer will contain data.
   * // The Observation sublayer will contain exactly one entity.
   * {
   *   generateAllSublayers: true,
   *   namedTypeDefinition:[{
   *     key: "Observation",
   *     value:{
   *       useAllData: false,
   *       members: [{
   *         key: "{32CBD5CB-EE31-4714-B14F-57BFE36AE094}",
   *         value: {
   *           id: "{32CBD5CB-EE31-4714-B14F-57BFE36AE094}",
   *         }
   *       }]
   *     }
   *   }]
   * }
   *
   * // this layer will contain a sublayer for all named types in the graph
   * // ('Observation', 'User', 'Species', "Observed", "Reviewed", "ObservedIn")
   * // but only the 'Observation' sublayer will contain data.
   * // the 'Observation' sublayer will contain all instance of the Observation entity type
   * {
   *   generateAllSublayers: true,
   *   namedTypeDefinition:[{
   *     key: "Observation",
   *     value:{
   *       useAllData: true
   *     }
   *   }]
   * }
   *
   * // A more complex example:
   * {
   * 	//sublayers will only be created for the types listed
   * 	generateAllSublayers: false,
   * 	namedTypeDefinitions: {
   * 		//include all `Species` entities that exist at the time the layer is created
   * 		Species: {
   * 			useAllData: true
   * 		},
   * 		//include all `User` entities that exist at the time the layer is created
   * 		User: {
   * 			useAllData: true
   * 		},
   * 		//include all only the specified `Observation` entities
   * 		Observation: {
   * 			useAllData:false,
   * 			members: {
   * 				"{941A7425-C45D-4940-A2E8-F3611973EC8A}": {
   * 					id: "{941A7425-C45D-4940-A2E8-F3611973EC8A}"
   * 				},
   * 				"{94DC1D53-4043-4D0B-8CF7-18B690414118}": {
   * 					id: "{94DC1D53-4043-4D0B-8CF7-18B690414118}"
   * 				},
   * 				//This entity has a fixed location so will remain in the same place regardless of the layout applied.
   * 				//the other entities will move around it
   * 				"{4E1D1ACE-6252-4BA4-B76E-CDEDFE9B0AB1}": {
   * 					id: "{4E1D1ACE-6252-4BA4-B76E-CDEDFE9B0AB1}",
   * 				},
   * 				"{559312DF-893C-44E2-AD86-BAA73CD49719}": {
   * 					id: "{559312DF-893C-44E2-AD86-BAA73CD49719}"
   * 				},
   * 				"{158A2D46-3EFF-4479-BC57-E6981FCB80B6}": {
   * 					id: "{158A2D46-3EFF-4479-BC57-E6981FCB80B6}"
   * 				},
   * 				"{40AD70FC-CD7D-4928-B555-38EA49675944}": {
   * 					id: "{40AD70FC-CD7D-4928-B555-38EA49675944}"
   * 				},
   * 				"{3A5B8F11-5971-4A46-99AC-F509CA59B517}": {
   * 					id: "{3A5B8F11-5971-4A46-99AC-F509CA59B517}"
   * 				}
   * 			}
   * 		},
   * 		//include all `Observed` relationships that exist at the time the layer is created
   * 		Observed: {
   * 			useAllData: true
   * 		},
   * 		//include all `ObservedIn` relationships that exist at the time the layer is created
   * 		ObservedIn: {
   * 			useAllData: true
   * 		}
   * 	}
   * }
   */
  accessor initializationInclusionModeDefinition: InclusionListDefinitionConstructor;
  /**
   * The default configuration options for a new link chart layer. This includes the layout and any layout settings for
   * the initial view of the layer.
   *
   * > [!IMPORTANT]
   * >
   * > **Constructor Only**
   * >
   * > This property is only supported when passed to the constructor on the first initialization of a link chart layer.
   * > Use [WebLinkChart#applyLayout()](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html#applyLayout) to update the layout and layout settings after initialization.
   */
  accessor initializationLinkChartConfig: InitializationLinkChartConfig | null | undefined;
  /**
   * A collection of operational [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html).
   * Each sublayer represents 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) in the graph.
   *
   * Each feature contained in each sublayer has a [Geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html)
   * that allows it to be rendered as a [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) with spatial context on the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html).
   * In `GEOGRAPHIC` layout mode, any spatial entities with [Geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html) will be drawn at their appropriate locations.
   * All non-spatial entities will be arrayed around the spatial entities they relate to.
   * In all other layouts, the geometry for each entity is its location on the link chart canvas.
   * The location of specific instances can be set so that when the layout mode changes or the link chart is reloaded, they remain in the same
   * spot.
   *
   * Features within the layer may also contain data [Graphic#attributes](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#attributes) that provide additional information that may be viewed in a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html).
   * These layers can also be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html#queryFeatures) and [analyzed](https://developers.arcgis.com/javascript/latest/spatial-analysis/intro-geometry-operators/).
   *
   * @example
   * //to access individual sublayers to add or modify properties such as the renderer, popups and labels
   * LinkChartLayer.layers.forEach((sublayer)=>{
   *  sublayer.popupTemplate = new PopupTemplate({
   *   title: "{common_name}",
   *   content: [{
   *     type: "text",
   *     text: "Scientific Name: {name}"
   *   }]
   *  });
   * })
   */
  get layers(): Collection<KnowledgeGraphSublayer>;
  /**
   * The [entity types](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-EntityType.html) included in the LinkChartLayer.
   *
   * @since 4.32
   */
  accessor memberEntityTypes: EntityType[];
  /**
   * The [relationship types](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-RelationshipType.html) included in the LinkChartLayer.
   *
   * @since 4.32
   */
  accessor memberRelationshipTypes: RelationshipType[];
  /**
   * All non-spatial [entity type](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-EntityType.html) and [relationship type](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraph-RelationshipType.html)
   * [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html). They have the same structure as the spatial [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-LinkChartLayer.html#layers) but the `geometryType` is null.
   * These layers can also be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-knowledgeGraph-KnowledgeGraphSublayer.html#queryFeatures) and [analyzed](https://developers.arcgis.com/javascript/latest/spatial-analysis/intro-geometry-operators/).
   * All link chart sublayers are considered spatial because they have a diagram location.
   */
  get tables(): Collection<KnowledgeGraphSublayer>;
  /** An optional title for the LinkChartLayer. */
  accessor title: string | null | undefined;
  /** The url of the [knowledge graph service](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-knowledgeGraphService.html). */
  accessor url: string;
  /** {@link layers/LinkChartLayer#calculateLinkChartLayout Calculates} the layout for the link chart and refreshes the canvas with the new layout. */
  applyNewLinkChartLayout(): Promise<void>;
  /**
   * Loads layer assuming that data for all of the members defined in the [initializationInclusionModeDefinition](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-LinkChartLayer.html#initializationInclusionModeDefinition) is already loaded into local storage.
   * This will optimize layer load times.
   */
  loadLayerAssumingLocalCache(): void;
}
declare const LinkChartLayerSuperclass: typeof Layer & typeof ScaleRangeLayer & typeof BlendLayer & typeof OperationalLayer