import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseDeviceInstallVO, DmsBaseDeviceInstallForm, DmsBaseDeviceInstallQuery } from '@/api/dms/dmsBaseDeviceInstall/types';

/**
 * 查询设备安装信息列表
 * @param query
 * @returns {*}
 */

export const listDmsBaseDeviceInstall = (query?: DmsBaseDeviceInstallQuery): AxiosPromise<DmsBaseDeviceInstallVO[]> => {
  return request({
    url: '/dms/dmsBaseDeviceInstall/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备安装信息详细
 * @param deviceInstallId
 */
export const getDmsBaseDeviceInstall = (deviceInstallId: string | number): AxiosPromise<DmsBaseDeviceInstallVO> => {
  return request({
    url: '/dms/dmsBaseDeviceInstall/' + deviceInstallId,
    method: 'get'
  });
};

/**
 * 新增设备安装信息
 * @param data
 */
export const addDmsBaseDeviceInstall = (data: DmsBaseDeviceInstallForm) => {
  return request({
    url: '/dms/dmsBaseDeviceInstall',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备安装信息
 * @param data
 */
export const updateDmsBaseDeviceInstall = (data: DmsBaseDeviceInstallForm) => {
  return request({
    url: '/dms/dmsBaseDeviceInstall',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备安装信息
 * @param deviceInstallId
 */
export const delDmsBaseDeviceInstall = (deviceInstallId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseDeviceInstall/' + deviceInstallId,
    method: 'delete'
  });
};

/**
 * Get install count
 * @returns
 */
export const getInstallCount = (params: any): AxiosPromise<number> => {
  return request({
    url: '/dms/dmsBaseDeviceInstall/count',
    method: 'get',
    params
  });
};


/**
 * 下拉框查询设备安装信息列表
 * @param query
 * @returns {*}
 */
export function getDmsBaseDeviceInstallList (query) {
    return request({
        url: '/dms/dmsBaseDeviceInstall/getDmsBaseDeviceInstallList',
        method: 'get',
        params: query
    });
};
