import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtSubsidyitemVO, PtSubsidyitemForm, PtSubsidyitemQuery } from '@/api/cardCenter/subsidy/ptSubsidyitem/types';

/**
 * 查询补助明细列表
 * @param query
 * @returns {*}
 */
export const listPtSubsidyitem = (query?: PtSubsidyitemQuery): AxiosPromise<PtSubsidyitemVO[]> => {
  return request({
    url: '/backstage/subsidy/ptSubsidyitem/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询补助明细详细
 * @param itemId
 */
export const getPtSubsidyitem = (itemId: string | number): AxiosPromise<PtSubsidyitemVO> => {
  return request({
    url: '/backstage/subsidy/ptSubsidyitem/' + itemId,
    method: 'get'
  });
};

/**
 * 新增补助明细
 * @param data
 */
export const addPtSubsidyitem = (data: PtSubsidyitemForm) => {
  return request({
    url: '/backstage/subsidy/ptSubsidyitem',
    method: 'post',
    data: data
  });
};

/**
 * 修改补助明细
 * @param data
 */
export const updatePtSubsidyitem = (data: PtSubsidyitemForm) => {
  return request({
    url: '/backstage/subsidy/ptSubsidyitem',
    method: 'put',
    data: data
  });
};

/**
 * 删除补助明细
 * @param itemId
 */
export const delPtSubsidyitem = (itemId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/subsidy/ptSubsidyitem/' + itemId,
    method: 'delete'
  });
};
