import request from '@/utils/request'

// 查询实验室列表
export function listSubject(query) {
  return request({
    url: '/laboratory/subject/list',
    method: 'get',
    params: query
  })
}

// 查询实验室列表-带权限
export function authListSubject(query) {
  return request({
    url: '/laboratory/subject/manger/list',
    method: 'get',
    params: query
  })
}

// 查询实验室详细
export function getSubject(id) {
  return request({
    url: '/laboratory/subject/' + id,
    method: 'get'
  })
}

// 变更实验管理员
export function setSubjectAdmin(data) {
  return request({
    url: '/laboratory/subject/'+data.userId+'/'+data.subId,
    method: 'put'
  })
}

// 新增实验室
export function addSubject(data) {
  return request({
    url: '/laboratory/subject',
    method: 'post',
    data: data
  })
}

// 修改实验室
export function updateSubject(data) {
  return request({
    url: '/laboratory/subject',
    method: 'put',
    data: data
  })
}

// 修改实验室(包含新危险源)
export function updateSubjectEditJoinHazard(data) {
  return request({
    url: '/laboratory/subject/editJoinHazard',
    method: 'put',
    data: data
  })
}

// 删除实验室
export function delSubject(id) {
  return request({
    url: '/laboratory/subject/' + id,
    method: 'delete'
  })
}

//获取指定用户权限下的实验室列表/subject/manger/my/list
export function getSubjectList(id) {
  console.log("id",id);
  return request({
    url: '/laboratory/subject/count/'+id,
    method: 'get',
  })
}
//获取当前用户权限下的实验室列表/subject/manger/my/list
export function getMySubjectList(data) {
  return request({
    url: '/laboratory/subject/manger/my/list',
    method: 'get'
  })
}
//根据院系查询未绑定的实验室
export function getNoAdminSubjectList(data) {
  return request({
    url: '/laboratory/subject/list/noadmin',
    method: 'get',
    params: data
  })
}

//根据院系查询实验室
export function getNoAdminSubjectListNopage(data) {
  return request({
    url: '/laboratory/subject/list/nopage',
    method: 'get',
    params: data
  })
}

//删除实验室
export function removeSubject(id) {
  return request({
    url: '/laboratory/subject/'+id,
    method: 'delete'
  })
}
//根据ID查询摄像头列表
export function channels(data) {
  return request({
    url: '/camera/api/device/query/devices/channels',
    method: 'get',
    params: data
  })
}

//根据ID查询摄像头地址
export function startUrl(data) {
  return request({
    url: '/camera/api/play/startList',
    type:'video',
    method: 'get',
    params: data
  })
}

//根据ID查询摄像头地址(南湖)
export function startUrlNH(query) {
  return request({
    url: '/nanhu/api/play/startList/',
    type:'video',
    method: 'get',
    params: query
  })
}

//根据ID查询摄像头地址(文昌)
export function startUrlWC(query) {
  return request({
    url: '/wenchang/api/play/startList/',
    type:'video',
    method: 'get',
    params: query
  })
}

//播放文字接口
export function mangerVoice(data,id) {
  return request({
    url: '/laboratory/subject/manger/voice/'+id,
    method: 'post',
    params: data
  })
}

//是否禁用实验室
export function subjectType(id,type) {
  return request({
    url: '/laboratory/subject/'+id+'/'+type,
    method: 'Delete',
  })
}

//获取物联设备配置列表
export function listBySubjectId(data) {
  return request({
    url: '/laboratory/hardware/listBySubjectId',
    method: 'get',
    params: data
  })
}

//添加传感器
export function addSensor(data) {
  return request({
    url: '/laboratory/sensor/',
    method: 'post',
    data: data
  })
}
//编辑传感器
export function putSensor(data) {
  return request({
    url: '/laboratory/sensor/',
    method: 'put',
    data: data
  })
}
//删除传感器
export function delSensor(id) {
  return request({
    url: '/laboratory/sensor/'+id,
    method: 'Delete',
  })
}

//添加一体机
export function addHardware(data) {
  return request({
    url: '/laboratory/hardware/',
    method: 'post',
    data: data
  })
}
//编辑一体机
export function putHardware(data) {
  return request({
    url: '/laboratory/hardware/',
    method: 'put',
    data: data
  })
}
//删除一体机
export function delHardware(id) {
  return request({
    url: '/laboratory/hardware/'+id,
    method: 'Delete',
  })
}

// 查询实验室详情
export function subjectInfo(id,type) {
  return request({
    url: '/laboratory/subject/manger/query/'+id+'/'+type,
    method: 'get',
  })
}

//根据人员ID查询人员列表
export function getSafeUserList(query) {
  return request({
    url: '/system/user/getSafeUserList',
    method: 'get',
    params: query
  })
}

// 修改实验室关联信息
export function editJoinHazard(data) {
  return request({
    url: '/laboratory/subject/editJoinHazard',
    method: 'put',
    data: data
  })
}
