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

/** @since 5.0 */
export interface TableDataSourceProperties extends Partial<Pick<TableDataSource, "dataSourceName" | "gdbVersion" | "workspaceId">> {}

/**
 * A table or feature class that resides in a registered workspace (either a folder or geodatabase).
 * In the case of a geodatabase, if versioned, use `version` to
 * switch to an alternate geodatabase version.
 *
 * @since 5.0
 * @see [Sample - MapImageLayer: toggle sublayer visibility](https://developers.arcgis.com/javascript/latest/sample-code/layers-mapimagelayer-sublayers/)
 * @see [Sample - MapImageLayer: dynamic data layer with table join](https://developers.arcgis.com/javascript/latest/sample-code/layers-dynamicdatalayer-table-join/)
 * @see [ArcGIS REST API - Table data source](https://developers.arcgis.com/rest/services-reference/enterprise/data-source-object/#table-data-source)
 * @example
 * let layer = new MapImageLayer({
 *    url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
 *    sublayers: [{
 *      renderer: renderer,
 *      source: {
 *        type: "data-layer",
 *        dataSource: {
 *          type: "table",
 *          workspaceId: "MyDatabaseWorkspaceIDSSR2",
 *          dataSourceName: "ss6.gdb.Railroads"
 *        }
 *      }
 *    }]
 *  });
 */
export default class TableDataSource extends JSONSupport {
  constructor(properties?: TableDataSourceProperties);
  /**
   * The name of the table in the registered workspace.
   *
   * @since 5.0
   */
  accessor dataSourceName: string;
  /**
   * References the geodatabase version if multiple versions exist in the geodatabase.
   *
   * @since 5.0
   */
  accessor gdbVersion: string;
  /**
   * This value is always `table`.
   *
   * @since 5.0
   */
  get type(): "table";
  /**
   * The workspace where the table resides as defined in the ArcGIS Server Manager.
   *
   * @since 5.0
   */
  accessor workspaceId: string;
}