import type Accessor from "../core/Accessor.js";
import type PortalQueryParams from "./PortalQueryParams.js";

export interface PortalQueryResultProperties<T = object> extends Partial<Pick<PortalQueryResult<T>, "nextQueryParams" | "queryParams" | "results" | "total">> {}

/**
 * Represents the result object returned from a portal query.
 *
 * @since 4.0
 * @see [Portal.queryGroups()](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#queryGroups)
 * @see [Portal.queryItems()](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#queryItems)
 * @see [PortalGroup.queryItems()](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalGroup.html#queryItems)
 */
export default class PortalQueryResult<T = object> extends Accessor {
  constructor(properties?: PortalQueryResultProperties<T>);
  /** The query parameters for the next set of results. */
  accessor nextQueryParams: PortalQueryParams | null | undefined;
  /** The query parameters for the first set of results. */
  accessor queryParams: PortalQueryParams | null | undefined;
  /** An array of result item objects. */
  accessor results: T[];
  /** The total number of results. */
  accessor total: number;
}