import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CrmGiftApplyDetailForm, CrmGiftApplyDetailQuery, CrmGiftApplyDetailVO } from '@/api/oa/crm/crmGiftApplyDetail/types';

/**
 * 查询礼品申请明细列表
 * @param query
 * @returns {*}
 */

export const listCrmGiftApplyDetail = (query?: CrmGiftApplyDetailQuery): AxiosPromise<CrmGiftApplyDetailVO[]> => {
  return request({
    url: '/oa/crm/crmGiftApplyDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询礼品申请明细详细
 * @param detailId
 */
export const getCrmGiftApplyDetail = (detailId: string | number): AxiosPromise<CrmGiftApplyDetailVO> => {
  return request({
    url: '/oa/crm/crmGiftApplyDetail/' + detailId,
    method: 'get'
  });
};

/**
 * 新增礼品申请明细
 * @param data
 */
export const addCrmGiftApplyDetail = (data: CrmGiftApplyDetailForm) => {
  return request({
    url: '/oa/crm/crmGiftApplyDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改礼品申请明细
 * @param data
 */
export const updateCrmGiftApplyDetail = (data: CrmGiftApplyDetailForm) => {
  return request({
    url: '/oa/crm/crmGiftApplyDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除礼品申请明细
 * @param detailId
 */
export const delCrmGiftApplyDetail = (detailId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/crm/crmGiftApplyDetail/' + detailId,
    method: 'delete'
  });
};

/**
 * 下拉框查询礼品申请明细列表
 * @param query
 * @returns {*}
 */
export function getCrmGiftApplyDetailList(query) {
  return request({
    url: '/oa/crm/crmGiftApplyDetail/getCrmGiftApplyDetailList',
    method: 'get',
    params: query
  });
}
