import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DataProductVO, DataProductForm, DataProductQuery } from '@/api/smarttrace/dataProduct/types';

/**
 * 查询产品展示列表
 * @param query
 * @returns {*}
 */

export const listDataProduct = (query?: DataProductQuery): AxiosPromise<DataProductVO[]> => {
  return request({
    url: '/smarttrace/dataProduct/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品展示详细
 * @param id
 */
export const getDataProduct = (id: string | number): AxiosPromise<DataProductVO> => {
  return request({
    url: '/smarttrace/dataProduct/getInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增产品展示
 * @param data
 */
export const addDataProduct = (data: DataProductForm) => {
  return request({
    url: '/smarttrace/dataProduct/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品展示
 * @param data
 */
export const updateDataProduct = (data: DataProductForm) => {
  return request({
    url: '/smarttrace/dataProduct/edit',
    method: 'post',
    data: data
  });
};

/**
 * 删除产品展示
 * @param id
 */
export const delDataProduct = (id: string | number | Array<string | number>) => {
  return request({
    url: '/smarttrace/dataProduct/remove/' + id,
    method: 'get'
  });
};
