import api from 'src/config/api';
import {
  ServiceManagementRole,
  type ServiceReportParsedFilters,
} from 'src/pages/dashboard/serviceManagement/types';

export const downloadConsolidatedReport = (
  filters: ServiceReportParsedFilters,
  role: ServiceManagementRole = ServiceManagementRole.AGENT,
) =>
  api.post('workflows/reports/task-report', {
    ...filters,
    role,
  });

export const downloadServiceReport = (
  filters: ServiceReportParsedFilters,
  role: ServiceManagementRole = ServiceManagementRole.AGENT,
) =>
  api.post('workflows/reports/services-report', {
    ...filters,
    role,
  });

export const downloadTaskCertificate = (taskId: string) =>
  api.get(`workflows/tasks/${taskId}/certificate`, {
    responseType: 'blob',
  });
