import { AppError, Result } from '../utils/result';
import { WidgetDataLoaderInterface } from './widget-data-loader-interface';

/**
 * - WP - widget params
 * - DLP - dataloader params
 * - DBP - dashboard params
 * - DLR - dataloader result
 * - R - result
 */
export interface WidgetInterface<WP, DLP, DBP, DLR, R> {
  dataLoader: WidgetDataLoaderInterface<DLP, DBP, DLR>;
  type: string;
  render(
    widgetParams: WP,
    dataLoaderParams: DLP,
    dashboardParams: DBP,
    dashboardId: string,
    widgetId: string,
  ): Promise<Result<R, AppError>>;
}
