import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProgramVO, ProgramForm, ProgramQuery } from '@/api/product/program/types';

/**
 * 查询产品解决方案/项目方案列表
 * @param query
 * @returns {*}
 */

export const listProgram = (query?: ProgramQuery): AxiosPromise<ProgramVO[]> => {
  return request({
    url: '/product/program/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品解决方案/项目方案详细
 * @param id
 */
export const getProgram = (id: string | number): AxiosPromise<ProgramVO> => {
  return request({
    url: '/product/program/' + id,
    method: 'get'
  });
};

/**
 * 新增产品解决方案/项目方案
 * @param data
 */
export const addProgram = (data: ProgramForm) => {
  return request({
    url: '/product/program',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品解决方案/项目方案
 * @param data
 */
export const updateProgram = (data: ProgramForm) => {
  return request({
    url: '/product/program',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品解决方案/项目方案
 * @param id
 */
export const delProgram = (id: string | number | Array<string | number>) => {
  return request({
    url: '/product/program/' + id,
    method: 'delete'
  });
};
