import type InputBase from "./InputBase.js";
import type { InputBaseProperties } from "./InputBase.js";
import type { EditType } from "../../support/forms/types.js";

export interface EditableInputProperties<Template extends any = any> extends InputBaseProperties {}

/**
 * A read-only class used by [FieldInput](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/FieldInput/) to determine if the [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/) input is editable.
 *
 * @since 4.33
 */
export default abstract class EditableInput<Template extends any = any> extends InputBase<Template> {
  /** Indicates if the input is editable. */
  get editable(): boolean;
  /**
   * The type of edit operation the form is being used for. This can influence
   * whether a field is editable or not (e.g., the layer only allows certain
   * edit operations)
   *
   * This is also the value that will be set for the Arcade variable
   * `$editcontext.editType` in the Arcade context used to evaluate form
   * expressions.
   *
   * Accepted values are "INSERT", "UPDATE", "DELETE", and "NA".
   *
   * For `FieldInput`s with value expressions, this property is also used in
   * determining whether or not the value expressions should be applied. Per the
   * [Web Map Specification](https://developers.arcgis.com/web-map-specification/objects/formFieldElement/),
   * value expressions are ignored if the associated layer field is not
   * editable. Determining whether the layer field is editable must consider
   * whether the specific type of edit being attempted is allowed. For example,
   * if a layer has the `supportsAdd` capability but does not have the
   * `supportsUpdate` capability, then the value expression will be applied if
   * `editType` is `INSERT` but ignored if `editType` is `UPDATE`.
   *
   * For the purposes of determining whether or not the layer allows the current
   * edit type, a value of `"NA"` is always considered allowed.
   *
   * @default "NA"
   */
  get editType(): EditType;
}