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

// Returns the last version of the template by default
export const getSurveyTemplate = (templateKey: string, taskId: string) =>
  api.get<CsatSurveyTemplate>(`workflows/csat/templates/key/${templateKey}`, {
    params: {
      taskId,
    },
  });

export const completeSurvey = (body: CsatSurveyResponseBody) =>
  api.post(`workflows/csat/responses`, body);
