import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DataEnterpriseVO, DataEnterpriseForm, DataEnterpriseQuery } from '@/api/smarttrace/dataEnterprise/types';

/**
 * 查询企业展示列表
 * @param query
 * @returns {*}
 */

export const listDataEnterprise = (query?: DataEnterpriseQuery): AxiosPromise<DataEnterpriseVO[]> => {
  return request({
    url: '/smarttrace/dataEnterprise/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询企业展示详细
 * @param id
 */
export const getDataEnterprise = (id: string | number): AxiosPromise<DataEnterpriseVO> => {
  return request({
    url: '/smarttrace/dataEnterprise/getInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增企业展示
 * @param data
 */
export const addDataEnterprise = (data: DataEnterpriseForm) => {
  return request({
    url: '/smarttrace/dataEnterprise/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改企业展示
 * @param data
 */
export const updateDataEnterprise = (data: DataEnterpriseForm) => {
  return request({
    url: '/smarttrace/dataEnterprise/edit',
    method: 'post',
    data: data
  });
};

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