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

export interface TerminalProperties extends Partial<Pick<Terminal, "id" | "isUpstreamTerminal" | "name">> {}

/**
 * A device feature can be assigned a terminal configuration, which could have one or more terminals. The terminal configuration defines the terminals and the permissable paths between them.
 * For example, a device feature could have a Dual Terminal configuration, which has a High and a Low terminal. A downstream trace starting from High side terminal will return the Low side terminal, however, the same trace starting from the Low side terminal won't return the High side terminal.
 *
 * Another example, a transformer with  tri-state terminal configuration (3 terminals) H, X1, X2. The allowed paths are H->X1 and H->X2 with a default path H->X1. Running a downstream trace from the H terminal will select X1 and anything underneath it but not X2. The device path can be altered with the terminalConfiguration field.
 * ```js
 *      H
 *
 *    /   \
 *
 * X1       X2
 * ```
 * The terminal class defines terminal properties.
 *
 * @since 4.20
 * @see [Learn more about terminal management](https://pro.arcgis.com/en/pro-app/latest/help/data/utility-network/about-terminal-management.htm)
 * @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/)
 */
export default class Terminal extends JSONSupport {
  constructor(properties?: TerminalProperties);
  /** A unique numeric identifier for the terminal. */
  accessor id: number;
  /** Returns whether this terminal is the upstream terminal. Applicable in a directional terminal configuration; always false otherwise. */
  accessor isUpstreamTerminal: boolean;
  /** The name of the terminal. */
  accessor name: string;
}