import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectInfoVO, ProjectInfoForm, ProjectInfoQuery } from '@/api/project/projectInfo/types';

/**
 * 查询项目信息列表
 * @param query
 * @returns {*}
 */

export const listProjectInfo = (query?: ProjectInfoQuery): AxiosPromise<ProjectInfoVO[]> => {
  return request({
    url: '/customer/projectInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目信息详细
 * @param id
 */
export const getProjectInfo = (id: string | number): AxiosPromise<ProjectInfoVO> => {
  return request({
    url: '/customer/projectInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增项目信息
 * @param data
 */
export const addProjectInfo = (data: ProjectInfoForm) => {
  return request({
    url: '/customer/projectInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目信息
 * @param data
 */
export const updateProjectInfo = (data: ProjectInfoForm) => {
  return request({
    url: '/customer/projectInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目信息
 * @param id
 */
export const delProjectInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/projectInfo/' + id,
    method: 'delete'
  });
};
