/// <reference path="../../index.d.ts" />
import type Color from "@arcgis/core/Color.js";
import type EsriError from "@arcgis/core/core/Error.js";
import type Graphic from "@arcgis/core/Graphic.js";
import type FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
import type Layer from "@arcgis/core/layers/Layer.js";
import type SubtypeSublayer from "@arcgis/core/layers/support/SubtypeSublayer.js";
import type UtilityNetwork from "@arcgis/core/networks/UtilityNetwork.js";
import type TraceResult from "@arcgis/core/rest/networks/support/TraceResult.js";
import type MapView from "@arcgis/core/views/MapView.js";
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
import type { ArcgisReferenceElement } from "../types.js";
import type { T9nMeta } from "@arcgis/lumina/controllers";

/**
 * This is a sub-component used by the **ArcgisUtilityNetworkTraceAnalysis** component.
 *
 * This sub-component takes a `TraceResult` instance as input.
 * Optionally, the title of a trace configuration can be provided as a heading to display.
 *
 * @since 4.34
 * @internal
 */
export abstract class ArcgisUtilityNetworkTraceResults extends LitElement {
  /** @internal */
  protected _messages: {
      gettingResults: string;
      headings: {
          features: string;
          functions: string;
          setColor: string;
          totalFeatures: string;
          traceResultsCustom: string;
          traceResultsGeneric: string;
      };
      labels: {
          aggregatedGeometryGraphicsColor: string;
          functionResults: string;
          numElements: string;
          numFeatures: string;
          numFunctions: string;
          traceResultElementsByLayer: string;
      };
      noResultsDescription: string;
      noResultsHeading: string;
      noSelectableFeatures: string;
      noTraceConfigDescription: string;
      noTraceConfigHeading: string;
      resultFeaturesAreHidden: string;
      traceErrors: {
          dirtyAreasDiscovered: string;
          noValidControllers: string;
      };
      traceFailedDescription: string;
      traceFailedHeading: string;
      unknown: string;
  } & T9nMeta<{
      gettingResults: string;
      headings: {
          features: string;
          functions: string;
          setColor: string;
          totalFeatures: string;
          traceResultsCustom: string;
          traceResultsGeneric: string;
      };
      labels: {
          aggregatedGeometryGraphicsColor: string;
          functionResults: string;
          numElements: string;
          numFeatures: string;
          numFunctions: string;
          traceResultElementsByLayer: string;
      };
      noResultsDescription: string;
      noResultsHeading: string;
      noSelectableFeatures: string;
      noTraceConfigDescription: string;
      noTraceConfigHeading: string;
      resultFeaturesAreHidden: string;
      traceErrors: {
          dirtyAreasDiscovered: string;
          noValidControllers: string;
      };
      traceFailedDescription: string;
      traceFailedHeading: string;
      unknown: string;
  }>;
  accessor aggregatedGeometryGraphicsColor: Color;
  /**
   * If true, the component will not be destroyed automatically when it is
   * disconnected from the document. This is useful when you want to move the
   * component to a different place on the page, or temporarily hide it. If this
   * is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-utility-network-trace-results/#destroy) method when you are done to
   * prevent memory leaks.
   *
   * @default false
   */
  accessor autoDestroyDisabled: boolean;
  get featuresFromSelectedLayer(): Graphic[];
  /** @default false */
  accessor hideFeatureResults: boolean;
  /** @default false */
  accessor isElementsSelected: boolean;
  accessor layers: Layer[];
  accessor messageOverrides: {
      gettingResults?: string | undefined;
      headings?: {
          features?: string | undefined;
          functions?: string | undefined;
          setColor?: string | undefined;
          totalFeatures?: string | undefined;
          traceResultsCustom?: string | undefined;
          traceResultsGeneric?: string | undefined;
      } | undefined;
      labels?: {
          aggregatedGeometryGraphicsColor?: string | undefined;
          functionResults?: string | undefined;
          numElements?: string | undefined;
          numFeatures?: string | undefined;
          numFunctions?: string | undefined;
          traceResultElementsByLayer?: string | undefined;
      } | undefined;
      noResultsDescription?: string | undefined;
      noResultsHeading?: string | undefined;
      noSelectableFeatures?: string | undefined;
      noTraceConfigDescription?: string | undefined;
      noTraceConfigHeading?: string | undefined;
      resultFeaturesAreHidden?: string | undefined;
      traceErrors?: {
          dirtyAreasDiscovered?: string | undefined;
          noValidControllers?: string | undefined;
      } | undefined;
      traceFailedDescription?: string | undefined;
      traceFailedHeading?: string | undefined;
      unknown?: string | undefined;
  };
  get numResults(): number;
  /**
   * By assigning the `id` attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
   *
   * @see [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component)
   */
  accessor referenceElement: ArcgisReferenceElement | string | undefined;
  accessor selectedFeature: Graphic | undefined;
  accessor selectedLayer: FeatureLayer | Layer | SubtypeSublayer | undefined;
  /** @default "ready" */
  accessor state: State;
  accessor traceConfigTitle: string | undefined;
  accessor traceError: EsriError<TraceErrorDetails> | undefined;
  accessor traceResult: TraceResult | undefined;
  accessor traceResultFeatures: Graphic[];
  accessor utilityNetwork: UtilityNetwork | undefined;
  accessor view: MapView | undefined;
  clearAggregatedGeometryGraphics(): void;
  /** Permanently destroy the component. */
  destroy(): Promise<void>;
  readonly arcgisAggregatedGeometryGraphicsColorChange: import("@arcgis/lumina").TargetedEvent<this, string>;
  readonly arcgisHideGraphicsChange: import("@arcgis/lumina").TargetedEvent<this, boolean>;
  readonly arcgisSelectedLayerChange: import("@arcgis/lumina").TargetedEvent<this, void>;
  readonly arcgisSelectedResultTypeChange: import("@arcgis/lumina").TargetedEvent<this, void>;
  readonly arcgisTraceResultFeaturesReady: import("@arcgis/lumina").TargetedEvent<this, void>;
  readonly "@eventTypes": {
    arcgisAggregatedGeometryGraphicsColorChange: ArcgisUtilityNetworkTraceResults["arcgisAggregatedGeometryGraphicsColorChange"]["detail"];
    arcgisHideGraphicsChange: ArcgisUtilityNetworkTraceResults["arcgisHideGraphicsChange"]["detail"];
    arcgisSelectedLayerChange: ArcgisUtilityNetworkTraceResults["arcgisSelectedLayerChange"]["detail"];
    arcgisSelectedResultTypeChange: ArcgisUtilityNetworkTraceResults["arcgisSelectedResultTypeChange"]["detail"];
    arcgisTraceResultFeaturesReady: ArcgisUtilityNetworkTraceResults["arcgisTraceResultFeaturesReady"]["detail"];
  };
}

/** @internal */
export type State = "loading" | "ready";

/** @internal */
export interface TraceErrorDetails {
  url?: string;
  raw?: {
      extendedCode?: number;
      message?: string;
  };
}