import http from "../http-common";

const getAll = (status) => {
  const params = {};
  if (status) {
    params.status = status;
  }
  return http.get("/carousels", { params });
};

const getCarousel = (id) => {
  return http.get(`/carousels/${id}`);
};

const createNewCarousel = (data) => {
  return http.post('/carousels', data);
};

const updateCarousel = (id, data) => {
  return http.put(`/carousels/${id}`, data);
};

const deleteCarousel = (id) => {
  return http.delete(`/carousels/${id}`);
};

const uploadCarouselFile = (data, carouselId, name, fileType) => {
  return http.post(`/files/upload-physical?objectId=${carouselId}&name=${name}&fileType=${fileType}&model=carousel`, data);
};

const getAllCarouselFiles = (carouselId, name, fileType) => {
  return http.get(`/files/uploadedDocs/carousel/${carouselId}/type/${fileType}/name/${name}`);
};

export const CarouselService = {
  getAll,
  getCarousel,
  createNewCarousel,
  updateCarousel,
  deleteCarousel,
  uploadCarouselFile,
  getAllCarouselFiles
}; 