import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProgramLinkVO, ProgramLinkForm, ProgramLinkQuery } from '@/api/product/programLink/types';

/**
 * 查询项目方案关联列表
 * @param query
 * @returns {*}
 */

export const listProgramLink = (query?: ProgramLinkQuery): AxiosPromise<ProgramLinkVO[]> => {
  return request({
    url: '/product/programLink/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询项目方案关联详细
 * @param id
 */
export const getProgramLink = (id: string | number): AxiosPromise<ProgramLinkVO> => {
  return request({
    url: '/product/programLink/' + id,
    method: 'get'
  });
};

/**
 * 新增项目方案关联
 * @param data
 */
export const addProgramLink = (data: ProgramLinkForm) => {
  return request({
    url: '/product/programLink',
    method: 'post',
    data: data
  });
};

/**
 * 修改项目方案关联
 * @param data
 */
export const updateProgramLink = (data: ProgramLinkForm) => {
  return request({
    url: '/product/programLink',
    method: 'put',
    data: data
  });
};

/**
 * 删除项目方案关联
 * @param id
 */
export const delProgramLink = (id: string | number | Array<string | number>) => {
  return request({
    url: '/product/programLink/' + id,
    method: 'delete'
  });
};
