import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CrmGiftInfoForm, CrmGiftInfoQuery, CrmGiftInfoVO } from '@/api/oa/crm/crmGiftInfo/types';

/**
 * 查询礼品信息列表
 * @param query
 * @returns {*}
 */

export const listCrmGiftInfo = (query?: CrmGiftInfoQuery): AxiosPromise<CrmGiftInfoVO[]> => {
  return request({
    url: '/oa/crm/crmGiftInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询礼品信息详细
 * @param giftId
 */
export const getCrmGiftInfo = (giftId: string | number): AxiosPromise<CrmGiftInfoVO> => {
  return request({
    url: '/oa/crm/crmGiftInfo/' + giftId,
    method: 'get'
  });
};

/**
 * 新增礼品信息
 * @param data
 */
export const addCrmGiftInfo = (data: CrmGiftInfoForm) => {
  return request({
    url: '/oa/crm/crmGiftInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改礼品信息
 * @param data
 */
export const updateCrmGiftInfo = (data: CrmGiftInfoForm) => {
  return request({
    url: '/oa/crm/crmGiftInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除礼品信息
 * @param giftId
 */
export const delCrmGiftInfo = (giftId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/crm/crmGiftInfo/' + giftId,
    method: 'delete'
  });
};

/**
 * 下拉框查询礼品信息列表
 * @param query
 * @returns {*}
 */
export function getCrmGiftInfoList(query) {
  return request({
    url: '/oa/crm/crmGiftInfo/getCrmGiftInfoList',
    method: 'get',
    params: query
  });
}
