import request from "@/utils/request";

/******************************** 改-常客管理 ********************************/
// 获得白名单列表
export function getPageList(data) {
  return request({
    url: "/admin/userWhitelis/getPageList",
    method: "post",
    data,
  });
}

// 添加白名单
export function insert(data) {
  return request({
    url: "/admin/userWhitelis/insert",
    method: "post",
    data,
  });
}

// 删除白名单
export function delete_user(id) {
  return request({
    url: "/admin/userWhitelis/delete",
    method: "get",
    params: {
      UserWhitelistId: id,
    },
  });
}

// 删除所有人员
export function deleteAll() {
  return request({
    url: "/admin/userWhitelis/deleteAll",
    method: "get",
    params: {},
  });
}

// 编辑白名单
export function update(data) {
  return request({
    url: "/admin/userWhitelis/update",
    method: "post",
    data,
  });
}

// 批量导入
export function uploadUserWhitelistExcel(data) {
  return request({
    url: "/admin/userWhitelis/uploadUserWhitelistExcel",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data,
  });
}
// 上传图片
export function pictureLocal(data) {
  return request({
    url: "/upload/pictureLocal",
    method: "post",
    data,
  });
}

/******************************** 改-访客管理 ********************************/
// 获得访客列表
export function getPageListVisitor(data) {
  return request({
    url: "/admin/userVisitorList/getPageList",
    method: "post",
    data,
  });
}

// 访客添加到常客
export function addWhiteList(id) {
  return request({
    url: "/admin/userVisitorList/addWhite",
    method: "get",
    params: { id },
  });
}
// 访客批量添加到常客
export function addWhiteAll(data) {
  return request({
    url: "/admin/userVisitorList/addWhiteAll",
    method: "post",
    data,
  });
}

// 访客添加到黑名单
export function addBlackList(id) {
  return request({
    url: "/admin/userVisitorList/addBlack",
    method: "get",
    params: { id },
  });
}

/******************************** 改-黑名单管理 ********************************/
// 获得常客列表
export function getPageListBlack(data) {
  return request({
    url: "/admin/userBlackList/getPageList",
    method: "post",
    data,
  });
}

// 移除黑名单
export function removeBlack(id) {
  return request({
    url: "/admin/userBlackList/delete",
    method: "get",
    params: {
      id: id,
    },
  });
}

/******************************** 编辑账号资料 ********************************/
// 编辑账号资料
export function doEditSelf(data) {
  return request({
    url: "/admin/auth/updateAdmin",
    method: "post",
    data,
  });
}

/******************************** 账号管理 ********************************/
// 批量导入
export function uploadAdminInfoExcel(data) {
  return request({
    url: "/admin/auth/uploadAdminInfoExcel",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data,
  });
}

/******************************** 数据大屏 ********************************/

// 通行信息
export function getAdminData() {
  return request({
    url: "admin/dataShow/getAdminData",
    method: "post",
    data: {},
  });
}

// 进出人员数据
export function getInOutData(data) {
  return request({
    url: "inOutStatistics/data",
    method: "post",
    data,
  });
}

// 设备数量
export function getDeviceNumber() {
  return request({
    url: "/admin/dataShow/getDeviceNumber",
    method: "post",
    data: {},
  });
}
// -----------------预约场景-------------------------

// 删除预约信息
export function appointmentDelete(placeDetailId) {
  return request({
    url: `/admin/place/appointmentDelete`,
    method: "get",
    params: { placeDetailId },
  });
}
// 预约信息保存
export function appointmentSave(data) {
  return request({
    url: "/admin/place/appointmentSave",
    method: "post",
    data,
  });
}
// 修改状态预约信息
export function appointmentUpdate(data) {
  return request({
    url: "/admin/place/appointmentUpdate",
    method: "post",
    data,
  });
}

// 查询
export function getplace() {
  return request({
    url: "/admin/place/query",
    method: "get",
    params: {},
  });
}
// 基础信息保存
export function placeSave(data) {
  return request({
    url: "/admin/place/save",
    method: "post",
    data,
  });
}
// 预约列表
// 查询
export function appointmentPerson(data) {
  return request({
    url: "/admin/appointmentPerson/getPageList",
    method: "post",
    data,
  });
}
// 详情
export function detail(id) {
  return request({
    url: `/admin/appointmentPerson/detail/${id}`,
    method: "get",
  });
}
// 重新下发
export function issue(id) {
  return request({
    url: `/admin/appointmentPerson/issue/${id}`,
    method: "post",
  });
}
// 全量下发
export function appointmentPersonIssueAll(data) {
  return request({
    url: "/admin/appointmentPerson/issueAll",
    method: "post",
    data,
  });
}

// 全量下发-新版（携带有效期）
export function addSnIssued(data) {
  return request({
    url: `/admin/appointmentPerson/issueAll/${deviceId}`,
    data: data,
    method: "get",
  });
}

// 删除
export function deleteId(id) {
  return request({
    url: `/admin/appointmentPerson/${id}`,
    method: "DELETE",
  });
}

// -----------------健康码三方对接-------------------------
// 分页
export function healthCodeGetPageList(data) {
  return request({
    url: "/admin/healthCodeConfig/getPageList",
    method: "post",
    data,
  });
}
// 保存
export function healthCodeSave(data) {
  return request({
    url: "/admin/healthCodeConfig/save",
    method: "post",
    data,
  });
}
// 删除
export function healthCodeDel(id) {
  return request({
    url: `/admin/healthCodeConfig/del/${id}`,
    method: "delete",
  });
}
// 获取常客有效期
export function getUserWhitelistEffectiveTime(adminId) {
  return request({
    url: "/admin/userWhitelis/getUserWhitelistEffectiveTime",
    method: "get",
    params: { adminId },
  });
}

// 常客--批量编辑
export function editUserWhitelistExcel(data) {
  return request({
    url: "/admin/userWhitelis/editUserWhitelistExcel",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data,
  });
}
// 新增黑名单
export function iuserBlackListInsert(data) {
  return request({
    url: "/admin/userBlackList/insert",
    method: "post",
    data,
  });
}
// -------------楼宇常客审核权限-----------------
// 权限人员列表
export function userWhitelistCheckGetPageList(data) {
  return request({
    url: "/admin/userWhitelistCheck/getPageList",
    method: "post",
    data,
  });
}
// 获取公司列表列表
export function getAdminList() {
  return request({
    url: "/admin/userWhitelistCheck/getAdminList",
    method: "get",
  });
}

// 获取常客列表
export function getUserWhitelist(adminId) {
  return request({
    url: "/admin/userWhitelistCheck/getUserWhitelist",
    method: "get",
    params: { adminId },
  });
}
// 添加人员
export function userWhitelistCheckInsert(data) {
  return request({
    url: "/admin/userWhitelistCheck/insert",
    method: "post",
    data,
  });
}
// 删除人员
export function userWhitelistCheckDelete(userWhitelistCheckId) {
  return request({
    url: "/admin/userWhitelistCheck/delete",
    method: "get",
    params: { userWhitelistCheckId },
  });
}
