import request from '@/utils/request';
import { SlideshowVO, SlideshowForm } from './types';

/** 查询全部轮播图 */
export const listSlideshow = () => {
  return request<SlideshowVO[]>({ url: '/system/applet/slideshow/list', method: 'get' });
};

/** 根据ID查询 */
export const getSlideshow = (id: string) => {
  return request<SlideshowVO>({ url: `/system/applet/slideshow/${id}`, method: 'get' });
};

/** 新增轮播图 */
export const addSlideshow = (data: SlideshowForm) => {
  return request({ url: '/system/applet/slideshow', method: 'post', data });
};

/** 修改轮播图 */
export const editSlideshow = (data: SlideshowForm) => {
  return request({ url: '/system/applet/slideshow', method: 'put', data });
};

/** 删除轮播图 */
export const delSlideshow = (ids: string | string[]) => {
  const idStr = Array.isArray(ids) ? ids.join(',') : ids;
  return request({ url: `/system/applet/slideshow/${idStr}`, method: 'delete' });
};
