import type { IdentifiableMixin, IdentifiableMixinProperties } from "../../core/Identifiable.js";
import type { JSONSupportMixin, JSONSupportMixinProperties } from "../../core/JSONSupport.js";
import type { Loadable, LoadableMixinProperties } from "../../core/Loadable.js";
import type { AbortOptions } from "../../core/promiseUtils.js";
import type { ServiceCapabilities, LayerInfo, TableInfo, ServiceEdits, ServiceEditsResult, ServiceEditOptions, ServiceContents } from "./types.js";

export interface FeatureServiceProperties extends LoadableMixinProperties, IdentifiableMixinProperties, JSONSupportMixinProperties, Partial<Pick<FeatureService, "layerInfos" | "tableInfos" | "url" | "userTypeExtensions">> {}

/**
 * This class contains metadata about the feature service.
 * The class can be constructed via a url to a feature service or
 * from the class [utils](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-featureService-utils.html) using the [createFeatureServices()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-featureService-utils.html#createFeatureServices) method.
 *
 * @since 4.28
 */
export default class FeatureService extends FeatureServiceSuperclass {
  /**
   * @example
   * // Create a FeatureService from a url
   * const featureService = new FeatureService({
   *  url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer"
   * });
   * @example
   * // Create a FeatureService using [createFeatureServices()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-featureService-utils.html#createFeatureServices)
   * const layer1 = new FeatureLayer({url: `https://sampleserver6.arcgisonline.com/arcgis/rest/services/TestService/FeatureServer/12`});
   * const layer2 = new FeatureLayer({url: `https://sampleserver6.arcgisonline.com/arcgis/rest/services/TestService/FeatureServer/13`});
   * const layers = [layer1, layer2];
   * const mapOfServices = createFeatureServices(layers);
   * //loading featureService from map object.
   * const featureService = await mapOfServices.get(`https://sampleserver6.arcgisonline.com/arcgis/rest/services/TestService/FeatureServer`).featureService.load();
   */
  constructor(properties?: FeatureServiceProperties);
  /** Describes the layer's supported capabilities. */
  get capabilities(): ServiceCapabilities | null | undefined;
  /**
   * Describes effective capabilities of the service taking in to consideration privileges of the currently signed-in user.
   *
   * @since 4.30
   */
  get effectiveCapabilities(): ServiceCapabilities | null;
  /** Contains info of all layers in the Feature Service. */
  accessor layerInfos: LayerInfo[];
  /**
   * Indicates whether the instance has loaded. When `true`,
   * the properties of the object can be accessed. A WebMap is considered loaded
   * when its {@link rest/featureService/FeatureService#layers} and {@link rest/featureService/FeatureService#basemap} are created, but not
   * yet loaded.
   *
   * @default false
   */
  get loaded(): boolean;
  /** Contains info of all tables in the Feature Service. */
  accessor tableInfos: TableInfo[];
  /** The absolute URL of the REST endpoint for the feature service. The URL may either point to a resource on ArcGIS Enterprise or ArcGIS Online. */
  accessor url: string;
  /** Describes the service's userTypeExtensions. */
  accessor userTypeExtensions: string[];
  /** The url that points to the utility network layer, if it exists. */
  get utilityNetworkUrl(): string | null;
  /** The url to the version management service, if the data is versioned. */
  get versionManagementServiceUrl(): string | null;
  /**
   * Applies edits to features in the feature service layers. New features can be created and existing features can be updated or deleted. Feature geometries and/or attributes may be modified.
   * Only applicable to layers in a [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm).
   *
   *
   * > [!WARNING]
   * >
   * > When calling the applyEdits method on a service that does not have [vertical coordinate system](https://pro.arcgis.com/en/pro-app/help/mapping/properties/vertical-coordinate-systems.htm) information,
   * > the z-values of the geometries in the `edits` object will automatically be converted to match the spatial reference of the layer.
   * > Example: The service has a horizontal spatial reference with `feet` units, and `applyEdits()` is called with z-values based on `meter` units,
   * > then the method will automatically convert the z values from `meter` to `feet` units. `applyEdits()` will pass in a `sessionId` during an active edit session.
   *
   * > [!WARNING]
   * >
   * > The `deleteAssociations`, `combineGroupedObjects`, and `divideGroupedObjects` edits are in beta and are reserved for
   * > future use in a telecom domain network.
   *
   * @param edits - Object containing features and attachments to be added, updated or deleted.
   * @param options - Additional edit options to specify when editing features or attachments.
   * @returns Results returned from the [applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-featureService-FeatureService.html#applyEdits) method. It contains features
   * that were added, deleted or updated in different feature layers. It also contains the edit moment.
   * @example
   * featureService.applyEdits(
   *   [
   *     {
   *       id: 1,  // layer id of the layer in the feature service
   *       identifierFields: { globalIdField: "GLOBALID", objectIdField: "OBJECTID" },
   *       addFeatures: [
   *         new Graphic({
   *                 geometry: new Point({
   *                   x: -13293155.7588,
   *                   y: 4038940.6944999993,
   *                   z: 0,
   *                   spatialReference: {
   *                     wkid: 102100,
   *                     latestWkid: 3857,
   *                     xyTolerance: 0.001,
   *                     zTolerance: 0.001,
   *                     mTolerance: 0.001,
   *                     falseX: -20037700,
   *                     falseY: -30241100,
   *                     xyUnits: 10000,
   *                     falseZ: -100000,
   *                     zUnits: 10000,
   *                     falseM: -100000,
   *                     mUnits: 10000
   *                   }
   *                 }),
   *                 attributes: {
   *                   objectid: 3,
   *                   name: "test",
   *                   globalid: "{8E17A611-B139-46E4-A645-AC50A1DD2CCE}",
   *                   created_user: "unadmin",
   *                   created_date: 1694024410000,
   *                   last_edited_user: "unadmin",
   *                   last_edited_date: 1694024410000
   *                 }
   *               }))
   *       ]
   *     }
   *   ],
   *   {
   *     gdbVersion: "user.versionName",
   *     globalIdUsed: false,
   *     honorSequenceOfEdits: false,
   *     usePreviousEditMoment: false
   *   }
   * );
   */
  applyEdits(edits: ServiceEdits[], options?: ServiceEditOptions): Promise<ServiceEditsResult[]>;
  /**
   * Triggers the loading of the feature service instance and fetches all layers and tables.
   *
   * Fully loads the Feature Service definition.
   *
   * @param options - Additional options.
   * @returns Resolves when the Feature Service is [loaded](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-featureService-FeatureService.html#loaded).
   */
  fetchAllLayersAndTables(options?: AbortOptions | null | undefined): Promise<ServiceContents>;
  /**
   * Triggers the loading of the feature service instance.
   *
   * Fully loads the Feature Service definition.
   *
   * @param options - Additional options.
   * @returns Resolves when the Feature Service is [loaded](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-featureService-FeatureService.html#loaded).
   */
  load(options?: AbortOptions | null | undefined): Promise<this>;
}
declare const FeatureServiceSuperclass: typeof Loadable & typeof IdentifiableMixin & typeof JSONSupportMixin