import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PptSchemeVO, PptSchemeForm, PptSchemeQuery } from '@/api/product/pptScheme/types';

/**
 * 查询PPT 方案主列表
 * @param query
 * @returns {*}
 */

export const listPptScheme = (query?: PptSchemeQuery): AxiosPromise<PptSchemeVO[]> => {
  return request({
    url: '/product/pptScheme/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询PPT 方案主详细
 * @param id
 */
export const getPptScheme = (id: string | number): AxiosPromise<PptSchemeVO> => {
  return request({
    url: '/product/pptScheme/' + id,
    method: 'get'
  });
};

/**
 * 新增PPT 方案主
 * @param data
 */
export const addPptScheme = (data: PptSchemeForm) => {
  return request({
    url: '/product/pptScheme',
    method: 'post',
    data: data
  });
};

/**
 * 修改PPT 方案主
 * @param data
 */
export const updatePptScheme = (data: PptSchemeForm) => {
  return request({
    url: '/product/pptScheme',
    method: 'put',
    data: data
  });
};

/**
 * 删除PPT 方案主
 * @param id
 */
export const delPptScheme = (id: string | number | Array<string | number>) => {
  return request({
    url: '/product/pptScheme/' + id,
    method: 'delete'
  });
};

/**
 * 分享方案
 * @param query
 */
export const sharePptScheme = (id: string | number, userIds: string | number | Array<string | number>) => {
  return request({
    url: '/product/pptScheme/share',
    method: 'post',
    data: { id, userIds }
  });
};
