const {
  request,
  threeElementsRequest
} = require("../func/request");

// let path = 'http://192.168.77.14:9100/yx-fyzd'
// let path = 'https://test.hz-hanghui.com:18890/yx-fyzd'
let path = 'https://tx.hz-hanghui.com:8088/yx-fyzd'
// let platform = 'http://192.168.77.19:8081/hanghui-server-platform'
let platform = 'https://tx.hz-hanghui.com:8088/hanghui-server-platform'
let hzHanghui = 'https://noise.hz-hanghui.com:8088/fyzd'

// 访客机设备-获取配置信息
const snConfig = data => {
  return request({
    url: platform + "/api/v1/fkj/device/sn/config",
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '设备配置获取失败 '
  });
};
// 访客机设备-修改配置信息
const updateConfig = data => {
  return request({
    url: "/api/v1/fkj/device/sn/updateConfig",
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '操作失败 '
  });
};

// 获取访客机辖区配置信息
const areaInfo = data => {
  return request({
    url: path + "/api/v1/fkj/area/info",
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '辖区配置获取失败 '
  });
};
// 获取楼层对应关系配置列表
const configList = data => {
  return request({
    url: path + "/floor/config/list",
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '楼层对应关系配置列表获取失败 '
  });
};
// 获取受访人列表
const visiteeList = (url, data) => {
  return request({
    url: url,
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '受访人列表获取失败 '
  });
};
// 设备上报心跳
const tracking = data => {
  return request({
    url: path + "/api/v1/fkj/heart/tracking",
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '上报心跳失败 '
  });
};
// 访客单机版二维码生成
const ethQrCode = (url, data) => {
  return request({
    url: url,
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '梯控二维码获取失败 '
  });
};
// 访客联机版（微光）二维码生成
const vguangQrCode = (url, data) => {
  return request({
    url: url,
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '闸机二维码获取失败 '
  });
};
// 拿用户身份证号换取三要素信息
const userInfoQuery = data => {
  return request({
    url: platform + "/api/v1/open/user/sync/query",
    data: data,
    method: "post",
    type: "application/json",
    timeout: 25000,
    errorTip: '用户信息获取失败 '
  });
};
// ⾃然⼈⻛险评分查询
const riskQuery = data => {
  return request({
    url: platform + "/api/v1/risk/query",
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '查询失败 '
  });
};
// 获取三要素在线配置接口
const threeElementsConfiguration = data => {
  return request({
    url: platform + "/api/v1/iot/device/config/sn/config",
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '在线配置接口获取失败 '
  });
};
// 传入接口
const threeElements = (url, data) => {
  return threeElementsRequest({
    url: url,
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '操作失败 '
  });
};
// 访客信息推送
const visitorRecords = (url, data) => {
  return threeElementsRequest({
    url: url,
    data: JSON.stringify(data),
    method: "post",
    type: "application/json",
    errorTip: '访客信息推送失败 '
  });
};
// 小程序二维码登记
const getVisitDeviceUser = (data) => {
  return request({
    url: hzHanghui + '/api/next/getVisitDeviceUser',
    data: data,
    method: "get",
    type: "application/x-www-form-urlencoded",
    errorTip: '登记失败 '
  });
};
// 访客机-登记信息列表
const visitorReportPageList = (data) => {
  return request({
    url: path + '/visitorReportPageList',
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '操作失败 '
  });
};
// 访客机-列表签离
const visitorSignOut = (data) => {
  return request({
    url: path + '/visitorSignOut',
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '签离失败 '
  });
};
// 访客机登记信息推送返回唯一值
const visitorReport = (data) => {
  return request({
    url: path + '/visitorReport',
    data: data,
    method: "post",
    type: "application/json",
    errorTip: '获取失败 '
  });
};
// 扫码签离
const visitorCodeSignOut = (data) => {
  return request({
    url: path + '/visitorCodeSignOut',
    data: data,
    method: "post",
    type: "application/json",
    errorTip: ' '
  });
};
module.exports = {
  snConfig,
  updateConfig,
  areaInfo,
  visiteeList,
  tracking,
  ethQrCode,
  vguangQrCode,
  userInfoQuery,
  riskQuery,
  threeElementsConfiguration,
  threeElements,
  visitorRecords,
  getVisitDeviceUser,
  visitorReportPageList,
  visitorSignOut,
  visitorCodeSignOut,
  visitorReport,
  configList,
};
