import type Graphic from "../../Graphic.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { GraphicProperties } from "../../Graphic.js";

export interface FindResultProperties extends Partial<Pick<FindResult, "displayFieldName" | "foundFieldName" | "layerId" | "layerName" | "value">> {
  /** The found feature. */
  feature?: GraphicProperties | null;
}

/**
 * The result from [find](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-find.html).
 *
 * @since 4.20
 * @see [find](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-find.html)
 * @see [FindParameters](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-FindParameters.html)
 */
export default class FindResult extends JSONSupport {
  constructor(properties?: FindResultProperties);
  /**
   * The name of the layer's primary display field.
   * The value of this property matches the name of one of the fields of the feature.
   */
  accessor displayFieldName: string | null | undefined;
  /** The found feature. */
  get feature(): Graphic | null | undefined;
  set feature(value: GraphicProperties | null | undefined);
  /** The name of the field that contains the search text. */
  accessor foundFieldName: string | null | undefined;
  /** Unique ID of the layer that contains the feature. */
  accessor layerId: number | null | undefined;
  /** The layer name that contains the feature. */
  accessor layerName: string | null | undefined;
  /** The value of the `foundFieldName` in the feature's attributes. */
  accessor value: string | number | null | undefined;
}