import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CombatProjectVO, CombatProjectForm, CombatProjectQuery } from '@/api/ygpassport/combatProject/types';

/**
 * 查询实战项目经历列表
 * @param query
 * @returns {*}
 */

export const listCombatProject = (query?: CombatProjectQuery): AxiosPromise<CombatProjectVO[]> => {
  const data = { query: query }
  return request({
    url: '/ygpassport/combatProject/listNew',
    method: 'post',
    data: data
  });
};

/**
 * 查询实战项目经历详细
 * @param id
 */
export const getCombatProject = (id: string | number): AxiosPromise<CombatProjectVO> => {
  return request({
    url: '/ygpassport/combatProject/' + id,
    method: 'get'
  });
};

/**
 * 新增实战项目经历
 * @param data
 */
export const addCombatProject = (data: CombatProjectForm) => {
  return request({
    url: '/ygpassport/combatProject',
    method: 'post',
    data: data
  });
};

/**
 * 修改实战项目经历
 * @param data
 */
export const updateCombatProject = (data: CombatProjectForm) => {
  return request({
    url: '/ygpassport/combatProject',
    method: 'put',
    data: data
  });
};

/**
 * 删除实战项目经历
 * @param id
 */
export const delCombatProject = (id: string | number | Array<string | number>) => {
  return request({
    url: '/ygpassport/combatProject/' + id,
    method: 'delete'
  });
};
