import api from 'src/config/api';
import {
  type CoordinatorFilterParams,
  type HelpDeskAssociatedMember,
  type ServiceMetrics,
} from 'src/pages/dashboard/serviceManagement/types';
import { type Pagination } from 'src/types/services';

export const getServiceMetrics = (params: CoordinatorFilterParams) =>
  api.get<ServiceMetrics>(
    `workflows/metrics/help-desks/${params.helpDeskId}/summary`,
    {
      params: {
        ...params,
        // This should be temporary until backend is updated
        startDate: params.createdAtFrom,
        endDate: params.createdAtTo,
      },
    },
  );

export const getAssociatedMembers = (params: CoordinatorFilterParams) =>
  api.get<Pagination<HelpDeskAssociatedMember[]>>(
    `workflows/metrics/help-desks/${params.helpDeskId}/agents`,
    {
      params: {
        ...params,
        // This should be temporary until backend is updated
        startDate: params.createdAtFrom,
        endDate: params.createdAtTo,
      },
    },
  );
