import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { NbqVO, NbqForm, NbqQuery } from '@/api/business/nbq/types';

/**
 * 查询逆变器列列表
 * @param query
 * @returns {*}
 */

export const listNbq = (query?: NbqQuery): AxiosPromise<NbqVO[]> => {
  return request({
    url: '/business/nbq/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询逆变器列详细
 * @param nbqId
 */
export const getNbq = (nbqId: string | number): AxiosPromise<NbqVO> => {
  return request({
    url: '/business/nbq/' + nbqId,
    method: 'get'
  });
};

/**
 * 新增逆变器列
 * @param data
 */
export const addNbq = (data: NbqForm) => {
  return request({
    url: '/business/nbq',
    method: 'post',
    data: data
  });
};

/**
 * 修改逆变器列
 * @param data
 */
export const updateNbq = (data: NbqForm) => {
  return request({
    url: '/business/nbq',
    method: 'put',
    data: data
  });
};

/**
 * 删除逆变器列
 * @param nbqId
 */
export const delNbq = (nbqId: string | number | Array<string | number>) => {
  return request({
    url: '/business/nbq/' + nbqId,
    method: 'delete'
  });
};
