import type Input from "./Input.js";
import type CodedValue from "../../../layers/support/CodedValue.js";
import type { CodedValueProperties } from "../../../layers/support/CodedValue.js";

export interface SwitchInputProperties {
  /** Coded value used when the switch state is turned off. This value can be of either a `string` or `number`. */
  offValue?: CodedValueProperties["code"];
  /** Coded value used when the switch state is turned on. This value can be of either a `string` or `number`. */
  onValue?: CodedValueProperties["code"];
}

/**
 * The `SwitchInput` class defines the desired user interface for a binary switch or toggle. This should be used when selecting between two options. This [FieldElement.input](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-FieldElement.html#input) is used in [field elements](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-FieldElement.html) that are set within a [feature layer's](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#formTemplate) or [FeatureForm's](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#formTemplate) `formTemplate`. This is displayed within the [Editor](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html) widget.
 *
 * > [!WARNING]
 * >
 * > Coded-value domains are required when using this input type.
 *
 * ![form field element switch input](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/formtemplate/switch-input.png)
 *
 * @since 4.20
 * @see [FieldElement](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-FieldElement.html)
 * @see [CodedValueDomain](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-CodedValueDomain.html)
 * @example
 * // Creates a new Switch input for a field element within a form
 * const switchInput = new SwitchInput({
 *   offValue: "No",
 *   onValue: "Yes"
 * });
 */
export default class SwitchInput extends Input {
  constructor(properties?: SwitchInputProperties);
  /** Coded value used when the switch state is turned off. This value can be of either a `string` or `number`. */
  get offValue(): CodedValue["code"];
  set offValue(value: CodedValueProperties["code"]);
  /** Coded value used when the switch state is turned on. This value can be of either a `string` or `number`. */
  get onValue(): CodedValue["code"];
  set onValue(value: CodedValueProperties["code"]);
  /** The type of form element input. */
  get type(): "switch";
}