import type Graphic from "../Graphic.js";
import type EsriMap from "../Map.js";
import type Accessor from "../core/Accessor.js";
import type Point from "../geometry/Point.js";
import type SpatialReference from "../geometry/SpatialReference.js";
import type FeatureAbilities from "./support/FeatureAbilities.js";
import type { IdentifiableMixin, IdentifiableMixinProperties } from "../core/Identifiable.js";
import type { SpatialReferenceProperties } from "../geometry/SpatialReference.js";
import type { FeatureFormattedAttributes, LastEditInfo, PopupTemplateContentResolved, RelatedInfo, State } from "./types.js";
import type { TimeZone } from "../time/types.js";
import type { MapViewOrSceneView } from "../views/MapViewOrSceneView.js";
import type { FeatureAbilitiesProperties } from "./support/FeatureAbilities.js";
import type { GraphicProperties } from "../Graphic.js";
import type { PointProperties } from "../geometry/Point.js";

/** @internal */
export interface FeatureProperties extends IdentifiableMixinProperties, Partial<Pick<Feature, "defaultPopupTemplateEnabled" | "map" | "view">> {
  /**
   * Defines the specific [FeatureAbilities](https://developers.arcgis.com/javascript/latest/references/core/popup/support/FeatureAbilities/) that the [Feature](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature/) component should use when querying and displaying its content.
   *
   * @internal
   */
  abilities?: FeatureAbilitiesProperties;
  /**
   * The [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) used to represent the feature.
   *
   * @internal
   * @see [PopupTemplate.content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content)
   * @example
   * let graphic = new Graphic({
   *   geometry: view.center,
   *   attributes: {
   *     "name": "Spruce",
   *     "family": "Pinaceae",
   *     "count": 126
   *   },
   *   symbol: new SimpleMarkerSymbol({
   *     style: "square",
   *     color: "blue",
   *     size: "8px"
   *   }),
   *   popupTemplate: {
   *     content: [
   *       {
   *         // Set popup template content
   *       }
   *     ]
   *   }
   * });
   */
  graphic?: GraphicProperties | null;
  /**
   * The [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) representing the location of the
   * [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) interaction used to trigger the opening of the component.
   *
   * This value should be set when executing Arcade expressions in the Feature component that
   * expect the `$userInput` profile variable to have a value.
   *
   * @internal
   * @see [PopupTemplate.content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content)
   * @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
   */
  location?: PointProperties | null;
  /**
   * The spatial reference used for [Arcade](https://developers.arcgis.com/arcade) operations.
   * This property should be set if executing Arcade expressions that contain [geometry functions](https://developers.arcgis.com/arcade/function-reference/geometry_functions/).
   *
   * @internal
   * @see [Type system](https://developers.arcgis.com/arcade/guide/types/#featuresetcollection)
   * @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
   */
  spatialReference?: SpatialReferenceProperties | null;
  /**
   * Dates and times will be displayed in this time zone. By default this time zone is
   * inherited from [MapView.timeZone](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone). When a MapView is not associated with this property then the property will fallback to the `system` time zone.
   *
   * **Possible Values**
   *
   * Value | Description |
   * ----- | ----------- |
   * system  | Dates and times will be displayed in the timezone of the device or browser.
   * unknown | Dates and time are not adjusted for any timezone.
   * Specified IANA timezone | Dates and times will be displayed in the specified IANA time zone. See [wikipedia - List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
   *
   * @internal
   */
  timeZone?: TimeZone | null;
}

/** @internal */
export type PopupViewModelContent = PopupTemplateContentResolved;

/**
 * Provides reactive state and logic for populating the [Feature](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature/) component.
 *
 * The class resolves popup template content for the current [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/), including evaluating Arcade expressions, formatting attribute values, and fetching related feature information.
 *
 * @internal
 * @see [Feature component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature/)
 * @see [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/)
 * @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
 * @see [Arcade - expression language](https://developers.arcgis.com/javascript/latest/arcade/)
 * @since 5.1
 */
export default class Feature extends FeatureSuperclass {
  /** @internal */
  constructor(properties?: FeatureProperties);
  /**
   * Defines the specific [FeatureAbilities](https://developers.arcgis.com/javascript/latest/references/core/popup/support/FeatureAbilities/) that the [Feature](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature/) component should use when querying and displaying its content.
   *
   * @internal
   */
  get abilities(): FeatureAbilities;
  set abilities(value: FeatureAbilitiesProperties);
  /**
   * The [PopupTemplate.content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content) of the feature.
   *
   * @internal
   */
  get content(): PopupViewModelContent | null | undefined;
  /**
   * Enables automatic creation of a popup template for layers that have popups enabled but no
   * popupTemplate defined. Automatic popup templates are supported for layers that
   * support the `createPopupTemplate` method. (Supported for
   * [BuildingComponentSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/),
   * [CatalogFootprintLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/catalog/CatalogFootprintLayer/),
   * [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/),
   * [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/),
   * [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/),
   * [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/)),
   * [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/),
   * [KnowledgeGraphSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/),
   * [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/),
   * [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/),
   * [PointCloudLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/PointCloudLayer/),
   * [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/),
   * [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/),
   * [Sublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/),
   * [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/),
   * [VoxelLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VoxelLayer/),
   * [WCSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WCSLayer/), and
   * [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/)).
   *
   * @default false
   * @internal
   */
  accessor defaultPopupTemplateEnabled: boolean;
  /**
   * A read-only map of Arcade expression names to their evaluated values for the current feature.
   *
   * @internal
   */
  get expressionAttributes(): Record<string, any> | null | undefined;
  /**
   * The formatted attributes calculated from `fieldInfo` [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/)
   * content. They are obtained from the feature's [graphic](#graphic) attribute values
   * and can be read:
   *  * globally using the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#fieldInfos) property
   *    directly at the root level of the [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/), or
   *  * per an individual content element. This element is defined with a [FieldsContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/FieldsContent/)
   *    popup element set on the PopupTemplate [PopupTemplate.content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content) property.
   *
   * @internal
   */
  get formattedAttributes(): FeatureFormattedAttributes | null | undefined;
  /**
   * The [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) used to represent the feature.
   *
   * @internal
   * @see [PopupTemplate.content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content)
   * @example
   * let graphic = new Graphic({
   *   geometry: view.center,
   *   attributes: {
   *     "name": "Spruce",
   *     "family": "Pinaceae",
   *     "count": 126
   *   },
   *   symbol: new SimpleMarkerSymbol({
   *     style: "square",
   *     color: "blue",
   *     size: "8px"
   *   }),
   *   popupTemplate: {
   *     content: [
   *       {
   *         // Set popup template content
   *       }
   *     ]
   *   }
   * });
   */
  get graphic(): Graphic | null | undefined;
  set graphic(value: GraphicProperties | null | undefined);
  /**
   * The heading for the feature.
   *
   * @default ""
   * @internal
   */
  get heading(): string;
  /**
   * Indicates whether the current [graphic](#graphic) resides in a non-spatial table.
   *
   * @internal
   */
  get isFeatureFromTable(): boolean;
  /**
   * A read-only property containing metadata regarding the last edit performed on a feature.
   * This object has the following properties:
   *
   * @internal
   */
  get lastEditInfo(): LastEditInfo | null | undefined;
  /**
   * The [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) representing the location of the
   * [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) interaction used to trigger the opening of the component.
   *
   * This value should be set when executing Arcade expressions in the Feature component that
   * expect the `$userInput` profile variable to have a value.
   *
   * @internal
   * @see [PopupTemplate.content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content)
   * @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
   */
  get location(): Point | null | undefined;
  set location(value: PointProperties | null | undefined);
  /**
   * A map is required when the input [graphic](#graphic) has a popupTemplate that contains [Arcade](https://developers.arcgis.com/arcade) expressions in [ExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/ExpressionInfo/) or [ExpressionContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/ExpressionContent/) that may use the `$map` profile variable to access data from layers within a map. Without a map, expressions that use `$map` will throw an error.
   *
   * Alternatively, the [view](#view) property can be used to provide the map instance for this property.
   *
   * @internal
   * @see [Type system](https://developers.arcgis.com/arcade/guide/types/#featuresetcollection)
   * @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
   * @example
   * // The building footprints represent the buildings that intersect a clicked parcel
   * let buildingFootprints = Intersects($feature, FeatureSetByName($map, "Building Footprints"));
   */
  accessor map: EsriMap | null | undefined;
  /**
   * A read-only map containing information about related features for the current feature.
   * The keys are related layer IDs as strings, and the values are [RelatedInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/types/#RelatedInfo) objects.
   * This property is populated when the feature has related fields and is used to manage and display related feature information.
   *
   * @internal
   */
  get relatedInfos(): Map<string, RelatedInfo>;
  /**
   * The spatial reference used for [Arcade](https://developers.arcgis.com/arcade) operations.
   * This property should be set if executing Arcade expressions that contain [geometry functions](https://developers.arcgis.com/arcade/function-reference/geometry_functions/).
   *
   * @internal
   * @see [Type system](https://developers.arcgis.com/arcade/guide/types/#featuresetcollection)
   * @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
   */
  get spatialReference(): SpatialReference | null | undefined;
  set spatialReference(value: SpatialReferenceProperties | null | undefined);
  /**
   * The current state of the Feature component.
   *
   * @default "disabled"
   * @internal
   */
  get state(): State;
  /**
   * Dates and times will be displayed in this time zone. By default this time zone is
   * inherited from [MapView.timeZone](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone). When a MapView is not associated with this property then the property will fallback to the `system` time zone.
   *
   * **Possible Values**
   *
   * Value | Description |
   * ----- | ----------- |
   * system  | Dates and times will be displayed in the timezone of the device or browser.
   * unknown | Dates and time are not adjusted for any timezone.
   * Specified IANA timezone | Dates and times will be displayed in the specified IANA time zone. See [wikipedia - List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
   *
   * @internal
   */
  get timeZone(): TimeZone;
  set timeZone(value: TimeZone | null | undefined);
  /**
   * A reference to the [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
   *
   * > [!WARNING]
   * >
   * > A view is required if the user expects to display content in any of the following situations:
   * > - The [graphic](#graphic) has a popupTemplate containing Arcade expressions in [ExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/ExpressionInfo/) or [ExpressionContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/ExpressionContent/) that may use [geometry functions](https://developers.arcgis.com/arcade/function-reference/geometry_functions/) or reference the `$map` profile variable (i.e. access data from layers within a map).
   * > - Content is displayed from the popup template of an [aggregate feature](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#isAggregate) (i.e. a [cluster](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/) or [bin](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/)).
   * > - Values from `date` and `timestamp-offset` [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/#type) should respect the view's [time zone](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone).
   *
   * @internal
   */
  accessor view: MapViewOrSceneView | null | undefined;
  /**
   * Indicates whether the feature is currently waiting for all of its content to finish loading.
   *
   * @internal
   */
  get waitingForContent(): boolean;
  /**
   * Fetches and updates the geometry of the [graphic](#graphic).
   * This method can be called to refresh the [graphic](#graphic)'s geometry before taking actions such as calling
   * [View2D.goTo()](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#goTo) with the graphic as the `target`.
   *
   * @returns A promise that resolves when the geometry update attempt has completed.
   * @internal
   */
  updateGeometry(): Promise<void>;
}
declare const FeatureSuperclass: typeof Accessor & typeof IdentifiableMixin