import { BaseApiService } from '@/services/api/base';
import { BaseApiResponse } from '@/types/api/api-general';
import { Dashboard } from '@/types/api/dashboard/dashboard';
import { httpClientFetcher } from '@/services/http/client';

class DashboardService extends BaseApiService<Dashboard, unknown, unknown> {
  constructor(basePath: string) {
    super(basePath);
  }

  /**
   * Fetch dashboard production data
   * @param endpoint - The endpoint URL with query parameters
   * @returns Promise with BaseApiResponse containing DashboardProduction
   */
  async getDashboardProductionFetcher(
    endpoint: string
  ): Promise<BaseApiResponse<Dashboard> | undefined> {
    return await httpClientFetcher<BaseApiResponse<Dashboard>>(
      `${endpoint ? endpoint : this.basePath}`
    );
  }
}

export const DashboardApi = new DashboardService('/dashboards');
