import request from '@/utils/request'
import {
  add,
  update,
  send
} from '@/api/base'

export function getTenantStratConfig (tenant) {
  return send({
    url: '/device/deviceAuditConfig/deviceAuditConfig',
    method: 'GET',
    params: { tenant }
  })
}

export function addTenantStratConfig (data) {
  return add({
    url: '/device/deviceAuditConfig/deviceAuditConfig',
    method: 'POST',
    data
  })
}

export function updateTenantStratConfig (data) {
  return update({
    url: '/device/deviceAuditConfig/deviceAuditConfig',
    method: 'PUT',
    data
  })
}

export function getDeviceServiceConfig (deviceId) {
  return send({
    url: '/device/deviceAuditConfig/deviceServiceConfig',
    method: 'GET',
    params: { deviceId, service: 1 }
  })
}

export function addDeviceServiceConfig (data) {
  return add({
    url: '/device/deviceAuditConfig/deviceServiceConfig',
    method: 'POST',
    data
  })
}

export function updateDeviceServiceConfig (data) {
  return update({
    url: '/device/deviceAuditConfig/deviceServiceConfig',
    method: 'PUT',
    data
  })
}

export function getHistory (query) {
  const { pageNum: pageIndex, pageSize, ...params } = query
  return request({
    url: '/deviceAudit/picAudit/listByPage',
    method: 'GET',
    params: {
      pageIndex, pageSize,
      ...params
    }
  })
}
