import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GiftBookVO, GiftBookForm, GiftBookQuery } from '@/api/main/giftBook/types';

/**
 * 查询礼薄列表
 * @param query
 * @returns {*}
 */

export const listGiftBook = (query?: GiftBookQuery): AxiosPromise<GiftBookVO[]> => {
  return request({
    url: '/main/giftBook/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询礼薄详细
 * @param id
 */
export const getGiftBook = (id: string | number): AxiosPromise<GiftBookVO> => {
  return request({
    url: '/main/giftBook/' + id,
    method: 'get'
  });
};

/**
 * 新增礼薄
 * @param data
 */
export const addGiftBook = (data: GiftBookForm) => {
  return request({
    url: '/main/giftBook',
    method: 'post',
    data: data
  });
};

/**
 * 修改礼薄
 * @param data
 */
export const updateGiftBook = (data: GiftBookForm) => {
  return request({
    url: '/main/giftBook',
    method: 'put',
    data: data
  });
};

/**
 * 删除礼薄
 * @param id
 */
export const delGiftBook = (id: string | number | Array<string | number>) => {
  return request({
    url: '/main/giftBook/' + id,
    method: 'delete'
  });
};
