import axios from "../../../../config/axios";
import { EndTaskTimeResponse, GetTaskTimesResponse, StartTaskTimeResponse } from "../types/TaskTimeTypes";

export const getTaskTimes = async (taskId: string): Promise<GetTaskTimesResponse> => {
  const { data } = await axios.get(`/task-manager/times/task/${taskId}`);
  return data;
};

export const startTimeTracking = async (taskId: string): Promise<StartTaskTimeResponse> => {
  const { data } = await axios.post(`/task-manager/times/start/${taskId}`);
  return data;
};

export const endTimeTracking = async (taskId: string): Promise<EndTaskTimeResponse> => {
  const { data } = await axios.post(`/task-manager/times/end/${taskId}`);
  return data;
};
