import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseDeviceDepreciationVO, DmsBaseDeviceDepreciationForm, DmsBaseDeviceDepreciationQuery } from '@/api/dms/dmsBaseDeviceDepreciation/types';

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

export const listDmsBaseDeviceDepreciation = (query?: DmsBaseDeviceDepreciationQuery): AxiosPromise<DmsBaseDeviceDepreciationVO[]> => {
  return request({
    url: '/dms/dmsBaseDeviceDepreciation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备折旧信息详细
 * @param deviceDepreciationId
 */
export const getDmsBaseDeviceDepreciation = (deviceDepreciationId: string | number): AxiosPromise<DmsBaseDeviceDepreciationVO> => {
  return request({
    url: '/dms/dmsBaseDeviceDepreciation/' + deviceDepreciationId,
    method: 'get'
  });
};

/**
 * 新增设备折旧信息
 * @param data
 */
export const addDmsBaseDeviceDepreciation = (data: DmsBaseDeviceDepreciationForm) => {
  return request({
    url: '/dms/dmsBaseDeviceDepreciation',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备折旧信息
 * @param data
 */
export const updateDmsBaseDeviceDepreciation = (data: DmsBaseDeviceDepreciationForm) => {
  return request({
    url: '/dms/dmsBaseDeviceDepreciation',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备折旧信息
 * @param deviceDepreciationId
 */
export const delDmsBaseDeviceDepreciation = (deviceDepreciationId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseDeviceDepreciation/' + deviceDepreciationId,
    method: 'delete'
  });
};


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