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

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

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

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

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

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

export function updateDeviceServiceConfig (data) {
  return update({
    url: '/device/deviceAudit/deviceAuditConfig',
    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
    }
  })
}
