import type DeviceLocationFeed from "./DeviceLocationFeed.js";
import type FeatureFenceParameters from "./FeatureFenceParameters.js";
import type Geotrigger from "./Geotrigger.js";
import type GeotriggerNotificationOptions from "./GeotriggerNotificationOptions.js";
import type { GeotriggerProperties } from "./Geotrigger.js";
import type { EnterExitRule, FeedAccuracyMode, FenceNotificationRule } from "./types.js";
import type { DeviceLocationFeedProperties } from "./DeviceLocationFeed.js";
import type { FeatureFenceParametersProperties } from "./FeatureFenceParameters.js";
import type { GeotriggerNotificationOptionsProperties } from "./GeotriggerNotificationOptions.js";

export interface FenceGeotriggerProperties extends GeotriggerProperties, Partial<Pick<FenceGeotrigger, "enterExitRule" | "feedAccuracyMode" | "fenceNotificationRule" | "name">> {
  /** The feed for this Geotrigger. */
  feed?: DeviceLocationFeedProperties | null;
  /** An object defining the fences to use for this Geotrigger. */
  fenceParameters?: FeatureFenceParametersProperties | null;
  /** Options that control the notification information sent to a client app when a Geotrigger condition is met. */
  notificationOptions?: GeotriggerNotificationOptionsProperties | null;
}

/**
 * A condition which monitors the dynamic elements of the geotrigger feed for enter/exit against the fences defined by the Fence Parameters.
 *
 * @since 4.24
 * @example
 * let fenceGeotrigger = new FenceGeotrigger({
 *   name: "Example Geotrigger - Notify when I am within 50m of my target areas.",
 *   enterExitRule: "enter-intersects-and-exit-does-not-intersect",
 *   feed: {
 *     filterExpression: {
 *       title: "Location filter",
 *       expression: "return $locationupdate.horizontalaccuracy <= 20"
 *     }
 *   },
 *   fenceNotificationRule: "enter",
 *   feedAccuracyMode: "use-geometry-with-accuracy",
 *   fenceParameters: {
 *     bufferDistance: 50,
 *     fenceSource: {
 *       layerUrl: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Recreation/MapServer/0"
 *     },
 *   },
 *   notificationOptions: {
 *     expressionInfo: {
 *       "title": "Expression",
 *       "expression": "'You have entered' + $fencefeature.AREA_NAME"
 *     }
 *   }
 * })
 */
export default class FenceGeotrigger extends Geotrigger {
  constructor(properties?: FenceGeotriggerProperties);
  /**
   * The rule that determines whether a fence polygon has been entered or exited by the geometry from a feed. The `feedAccuracyMode` must be set to `use-geometry-with-accuracy` for this property to have an effect.
   *
   *
   * Enter exit rule | Description |
   * ---------- | ----------- |
   * enter-intersects-and-exit-does-not-intersect | A fence polygon is entered when it intersects a feed geometry and exited when it no longer intersects.
   * enter-contains-and-exit-does-not-contain | A fence polygon is entered when it contains a feed geometry and exited when it is no longer contained.
   * enter-contains-and-exit-does-not-intersect | A fence polygon is entered when it contains a feed geometry and exited when it no longer intersects.
   *
   * @default "enter-contains-and-exit-does-not-intersect"
   */
  enterExitRule: EnterExitRule;
  /** The feed for this Geotrigger. */
  get feed(): DeviceLocationFeed | null | undefined;
  set feed(value: DeviceLocationFeedProperties | null | undefined);
  /**
   * Indicates how the geotrigger will use accuracy information from a feed.
   *
   * Feed accuracy mode | Description |
   * ---------- | ----------- |
   * use-geometry | The reported geometry from a feed will be used.
   * use-geometry-with-accuracy | The feed geometry will be used in conjunction with accuracy information.
   *
   * @default "use-geometry"
   */
  feedAccuracyMode: FeedAccuracyMode;
  /** Indicates the type of event that will trigger notifications for the Fence Geotrigger. For example, a value of `enter` will result in notifications when the geometry of the feed enters a fence polygon. */
  accessor fenceNotificationRule: FenceNotificationRule | null | undefined;
  /** An object defining the fences to use for this Geotrigger. */
  get fenceParameters(): FeatureFenceParameters | null | undefined;
  set fenceParameters(value: FeatureFenceParametersProperties | null | undefined);
  /** The name for this Geotrigger. */
  accessor name: string | null | undefined;
  /** Options that control the notification information sent to a client app when a Geotrigger condition is met. */
  get notificationOptions(): GeotriggerNotificationOptions | null | undefined;
  set notificationOptions(value: GeotriggerNotificationOptionsProperties | null | undefined);
  /** String indicating the Geotrigger condition type. */
  readonly type: "fence";
}