import api from "src/api";

export const getGroups = async () => {
  const { data } = await api.get("/group");
  return data.payload;
};

export const getGroupsForSelect = async () => {
  const { data } = await api.get("/selects/groups");
  return data.payload;
};

export const getGroup = async (id) => {
  const { data } = await api.get(`/group/${id}`);
  return data.payload;
};

export const createGroup = async (payload) => {
  const { data } = await api.post("/group", payload);
  return data.payload;
};

export const updateGroup = async (id, payload) => {
  const { data } = await api.put(`/group/${id}`, payload);
  return data.payload;
};

export const deleteGroup = async (id) => {
  const { data } = await api.delete(`/group/${id}`);
  return data;
};
