import request from "@/utils/request";
// (新)获取管理员列表(id 和 username)
export function getAdminListNew(data) {
  return request({
    url: "/admin/auth/getAdminListNew",
    method: "post",
    data,
  });
}

// 获得管理员列表
export function getUserList(data) {
  return request({
    url: "/admin/auth/doGetAdmins",
    method: "post",
    data,
  });
}

// 获得管理员列表
export function getUserListSearch() {
  return request({
    url: "/admin/auth/getAdminlist",
    method: "post",
  });
}

// 获得省份列表
export function getProvince() {
  return request({
    url: "/admin/areaCode/getProvince",
    method: "get",
    params: {},
  });
}

// 获得城市列表
export function getCity(areaCodeId) {
  return request({
    url: "/admin/areaCode/getCity",
    method: "get",
    params: {
      areaCodeId: areaCodeId,
    },
  });
}

// 获得区县列表
export function getArea(areaCodeId) {
  return request({
    url: "/admin/areaCode/getArea",
    method: "get",
    params: {
      areaCodeId: areaCodeId,
    },
  });
}

// 获得街道列表
export function getStreet(areaCodeId) {
  return request({
    url: "/admin/areaCode/getStreet",
    method: "get",
    params: {
      areaCodeId: areaCodeId,
    },
  });
}

// 获得派出所列表
export function getPolice(areaCodeId) {
  return request({
    url: "/admin/policeStationCode/getList",
    method: "get",
    params: {
      areaCodeId: areaCodeId,
    },
  });
}

// 添加&编辑管理员
export function doEditAdmin(data) {
  return request({
    url: "/admin/auth/doEditAdmin",
    method: "post",
    data,
  });
}

// 删除管理员
export function doDeleteAdmin(id) {
  return request({
    url: "/admin/auth/doDeleteAdmin",
    method: "delete",
    params: {
      id: id,
    },
  });
}

/**********************************************标签管理****************************/
// 获得标签列表
export function getTagList(provinceId) {
  return request({
    url: "/admin/tag/getList",
    method: "get",
    params: {
      provinceId: provinceId || null,
    },
  });
}

// 添加标签
export function insert(data) {
  return request({
    url: "/admin/tag/insert",
    method: "post",
    data,
  });
}

// 编辑标签
export function update(data) {
  return request({
    url: "/admin/tag/update",
    method: "post",
    data,
  });
}

// 删除标签
export function deleteTag(tagId) {
  return request({
    url: "/admin/tag/delete",
    method: "get",
    params: {
      tagId: tagId,
    },
  });
}

/**********************************************查询详情****************************/
// 查询详情
export function searchContent(data) {
  return request({
    url: "/admin/tag/insert",
    method: "post",
    data,
  });
}

// 自定义字段(访客，进出记录)
export function getContext(id) {
  return request({
    url: "/admin/face/getContext",
    method: "get",
    params: { id },
  });
}
// 自定义字段(常客)
export function getContextById(adminId) {
  return request({
    url: "/admin/face/getContextById",
    method: "get",
    params: { adminId },
  });
}
export function getContextByWhiteId(id) {
  return request({
    url: "/admin/face/getContextByWhiteId",
    method: "get",
    params: { id },
  });
}
export function getContextByFaceLog(params) {
  return request({
    url: "/admin/face/getContextByFaceLog",
    method: "get",
    params,
  });
}
// -------------------访客机接口----------------------------
// 根据进出记录获取访客机字段
export function getUserListFrom(params) {
  return request({
    url: "/admin/face/getUserListFrom",
    method: "get",
    params,
  });
}

// 根据访客id获取访客机字段
export function getVisitorListFrom(id) {
  return request({
    url: "/admin/face/getVisitorListFrom",
    method: "get",
    params: { id },
  });
}
// 根据常客id获取访客机字段
export function getWhiteListFrom(id) {
  return request({
    url: "/admin/face/getWhiteListFrom",
    method: "get",
    params: { id },
  });
}
// 常客列表-下载模板
export function doGetWhiteExcel() {
  return request({
    url: "/admin/userWhitelis/doGetWhiteExcel",
    method: "get",
    responseType: "blob",
    params: {},
  });
}
// -----------访客-------------------
// 访客删除
export function deleteVisitor(id) {
  return request({
    url: "/admin/userVisitorList/deleteVisitor",
    method: "get",
    params: { id },
  });
}
// 访客下发
export function addSingle(id) {
  return request({
    url: "/admin/userVisitorList/addSingle",
    method: "get",
    params: { id },
  });
}
// 访客记录分页
export function getDetailPageList(data) {
  return request({
    url: "/admin/userVisitorList/getDetailPageList",
    method: "post",
    data,
  });
}
// 访客记录详情
export function getDetailInfo(detailId) {
  return request({
    url: `/admin/userVisitorList/getDetailInfo/${detailId}`,
    method: "get",
  });
}

// ----------------------常访客导出------------------------
// 导出常客列表Excel
export function userWhitelistExcelOut(data) {
  return request({
    url: "/admin/userWhitelis/userWhitelistExcelOut",
    method: "post",
    data,
  });
}

// 导出访客列表Excel
export function userVisitorlistExcelOut(data) {
  return request({
    url: "/admin/userVisitorList/userVisitorlistExcelOut",
    method: "post",
    data,
  });
}
// -------------------楼宇场景-------------------
// 添加-编辑企业
export function saveEnterpriseAccount(data) {
  return request({
    url: "/admin/auth/saveEnterpriseAccount",
    method: "post",
    data,
  });
}
// 通过账号id查询详情
export function queryAdminById(id) {
  return request({
    url: `/admin/auth/queryAdminById/${id}`,
    method: "get",
  });
}
// 企业审核
export function audit(id, reviewStatus) {
  return request({
    url: `/admin/auth/audit/${id}/${reviewStatus}`,
    method: "post",
  });
}
// 查询企业账号信息
export function queryEnterpriseAccount(id) {
  return request({
    url: `/admin/auth/queryEnterpriseAccount`,
    method: "get",
  });
}
// -----------场所码---------
// 场所记录分页查询
export function placeRecordList(data) {
  return request({
    url: "/admin/placeRecord/getPageList",
    method: "post",
    data,
  });
}
// 查询账号场所码信息
export function queryPlaceInfos(adminId) {
  return request({
    url: `/admin/auth/queryPlaceInfos/${adminId}`,
    method: "get",
  });
}

// ---------私有区域-----------
// 获取私有区域列表
export function getPrivateAreaList(adminId) {
  return request({
    url: "/admin/privateArea/getPrivateAreaList",
    method: "get",
    params: { adminId },
  });
}

// 私有区域列表分页
export function privateAreaPageList(data) {
  return request({
    url: "/admin/privateArea/privateAreaPageList",
    method: "post",
    data,
  });
}
// 添加-修改私有区域
export function addOrUpdatePrivateArea(data) {
  return request({
    url: "/admin/privateArea/addOrUpdatePrivateArea",
    method: "post",
    data,
  });
}
// 删除私有区域
export function deletePrivateArea(privateAreaId) {
  return request({
    url: "admin/privateArea/deletePrivateArea",
    method: "get",
    params: { privateAreaId },
  });
}
// 私有区域设备列表分页
export function privateAreaDevicePageList(data) {
  return request({
    url: "/admin/privateArea/privateAreaDevicePageList",
    method: "post",
    data,
  });
}
// 获取私有区域设备列表
export function getPrivateAreaDeviceList(privateAreaId) {
  return request({
    url: "admin/privateArea/getPrivateAreaDeviceList",
    method: "get",
    params: { privateAreaId },
  });
}
// 获取人员类型列表
export function getUserWhitePersonnelTypeEnum() {
  return request({
    url: "admin/userWhitelis/getUserWhitePersonnelTypeEnum",
    method: "get",
    params: {},
  });
}
// 私有区域人员列表分页
export function privateAreaWhitelistPageList(data) {
  return request({
    url: "/admin/privateArea/privateAreaWhitelistPageList",
    method: "post",
    data,
  });
}
// ---------------下发任务列表----------------
// 分页
export function issuedList(data) {
  return request({
    url: "/admin/issuedTaskInfo/getPageList",
    method: "post",
    data,
  });
}
export function issuedCancel(id) {
  return request({
    url: `/admin/issuedTaskInfo/cancel/${id}`,
    method: "post",
  });
}
// ---------------行程码-行政区域列表列表----------------
export function riskAreaList(data) {
  return request({
    url: "/admin/auth/riskAreaList",
    method: "post",
    data,
  });
}
// 推送字段
export function fieldOptions(data) {
  return request({
    url: "/admin/auth/punch/field-options",
    method: "get",
    params: {},
  });
}
// ---------------下发删除自动化任务----------------
// 任务列表
export function getByPage(data) {
  return request({
    url: "/autoTaskInfo/getByPage",
    method: "post",
    data,
  });
}
// 取消任务
export function cancelTask(taskId) {
  return request({
    url: "/autoTaskInfo/cancelTask",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    method: "post",
    params: { taskId },
  });
}
// ---------------系统公告----------------
// 编辑公告
export function systemNoticeEdit(data) {
  return request({
    url: "/systemNotice/edit",
    method: "post",
    data,
  });
}
// 获取公告信息
export function systemNoticeGetNotice(data) {
  return request({
    url: "/systemNotice/getNotice",
    method: "post",
    data,
  });
}

// -------------场所码所属区域-------------
export function getPlaceAreas(data) {
  return request({
    url: "/admin/auth/getPlaceAreas",
    method: "get",
    params: {},
  });
}
// -------------获取商户平台列表-------------
export function doGetTenants(data) {
  return request({
    url: "/admin/face/doGetTenants",
    method: "post",
    data,
  });
}

// 获取操作人（家长）信息
export function getParentInfo(UserWhitelistId) {
  return request({
    url: "/admin/userWhitelis/getParentInfo",
    method: "get",
    params: {UserWhitelistId},
  });
}



// 常客的批量编辑
export function batchEditUserWhitelist(data) {
  return request({
    url: "/admin/userWhitelis/batchEditUserWhitelist",
    method: "post",
    // headers: {
    //   "Content-Type": "multipart/form-data",
    // },
    data,
  });
}
// 批量修改常客
export function batchUpdate(data) {
  return request({
    url: "/admin/userWhitelis/batchUpdate",
    method: "post",
    data,
  });
}
// 批量删除用户数据
export function batchDelete(data) {
  return request({
    url: "/admin/userWhitelis/batchDelete",
    method: "post",
    data
  });
}
// 批量下发用户数据
export function batchDistribution(data) {
  return request({
    url: "/admin/userWhitelis/batchDistribution",
    method: "post",
    data
  });
}
// ---------------进出预警记录--------------------
// 预警记录-分页列表
export function doGetWaringServerLog(data) {
  return request({
    url: "/admin/face/doGetWaringServerLog",
    method: "post",
    data,
  });
}
// 预警记录excel-导出
export function doGetWaringServerLogExcel(data) {
  return request({
    url: "/admin/face/doGetWaringServerLogExcel",
    method: "post",
    data,
  });
}
// 预警记录-确认
export function warningSure(data) {
  return request({
    url: "/admin/face/warningSure",
    method: "post",
    data,
  });
}
// 预警记录-删除
export function warningDelete(waringLogId) {
  return request({
    url: "/admin/face/warningDelete",
    method: "post",
    data:{waringLogId},
  });
}
// 预警记录-拉黑
export function warningBlack(waringLogId) {
  return request({
    url: "/admin/face/warningBlack",
    method: "post",
    data:{waringLogId},
  });
}
// -----------------------下发列表-------------------------
// 下发设备分页列表
export function devicePage(data) {
  return request({
    url: "/admin/issue/device/page",
    method: "post",
    data,
  });
}
// 下发设备详情
export function deviceDetail(issueDeviceId) {
  return request({
    url: `/admin/issue/device/detail/${issueDeviceId}`,
    method: "get",
  });
}
// 导出下发详情列表
export function itemExport(data) {
  return request({
    url: "/admin/issue/device/item/export",
    method: "post",
    data,
  });
}
// 下发设备详情分页列表
export function itemPage(data) {
  return request({
    url: "/admin/issue/device/item/page",
    method: "post",
    data,
  });
}
// 取消下发
export function deviceCancel(issueDeviceId) {
  return request({
    url: `/admin/issue/device/cancel/${issueDeviceId}`,
    method: "get",
  });
}
// 重试
export function deviceRetry(issueDeviceId) {
  return request({
    url: `/admin/issue/device/retry/${issueDeviceId}`,
    method: "get",
  });
}
// 访客记录-导出
export function detailExcelOut(data) {
  return request({
    url: '/admin/userVisitorList/detailExcelOut',
    method: 'post',
    responseType: 'blob',
    data: data
  })
}
