import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GiftBookDetailsVO, GiftBookDetailsForm, GiftBookDetailsQuery } from '@/api/main/giftBookDetails/types';

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

export const listGiftBookDetails = (query?: GiftBookDetailsQuery): AxiosPromise<GiftBookDetailsVO[]> => {
  return request({
    url: '/main/giftBookDetails/list',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增礼薄详情
 * @param data
 */
export const addGiftBookDetails = (data: GiftBookDetailsForm) => {
  return request({
    url: '/main/giftBookDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改礼薄详情
 * @param data
 */
export const updateGiftBookDetails = (data: GiftBookDetailsForm) => {
  return request({
    url: '/main/giftBookDetails',
    method: 'put',
    data: data
  });
};

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