import type { ModelParams } from "../interfaces/chart-interfaces.js";
import type { ChartModel } from "./chart-model.js";
import type { ChartConfig } from "../../utils/types/index.js";
import type { ChartTypes } from "../../utils/misc/index.js";

export abstract class ChartModelBase extends EventTarget {
  constructor(...args: any[]);
  /**
   * Promise that resolves when the setup process is complete.
   *
   * **Note:** This promise does not need to be awaited if the `setup` method has already been awaited. It is simply provided as a way to await the setup process from other functions if needed to avoid race conditions.
   */
  asyncUpdatesPromise: Promise<void>;
  /** The chart type. */
  get chartType(): ChartTypes;
  /** Data store object that can be used to store any data needed for the chart. */
  dataStore: any;
  /** Generate the proper chart title from the current config. */
  abstract generateChartTitle(): string;
  /**
   * Checks if the current chart model is for the same chart as another chart model.
   *
   * @param otherModel - The other chart model to compare to.
   */
  isSameChartAs(otherModel: ChartModel | undefined): boolean;
  /**
   * Completes the async setup process for the chart model. Must be called before using the model.
   *
   * @param params - The parameters to be used to set up the chart model.
   */
  abstract setup(params: ModelParams<ChartConfig>): Promise<void>;
  /** Can be awaited to allow any pending async updates to complete. */
  update(): Promise<void>;
}