import request from '@/utils/request'

const formDataHeader = {
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  }
}
/**
 * 获取 概览数据
 */
export const fetchOverviewData = () => request.get('/api/services/app/DeviceAuthorize/GetOverviewData')
/**
 * 获取 工单列表
 */
interface Devices {
  // 地区 eg 河南省
  provice?: string
}
export const fetchAuthorizeDevices = (params: Devices) =>
  request.get('/api/services/app/DeviceAuthorize/GetAuthorizeDevices', { params })

/**
 * 获取 地图设备列表
 */
export const fetchAuthorizeDevicesForMap = () =>
  request.get('/api/services/app/DeviceAuthorize/GetAuthorizeDevicesForMap')

/**
 * 获取 公司列表
 */
export const getAuthorizeCompany = () => request.get('/api/services/app/DeviceAuthorize/GetAuthorizeCompany')
/**
 *  搜索用户下 设备名称
 */
export const fetchAuthorizeDevicesByFilter = (params: any) =>
  request.get('/api/services/app/DeviceAuthorize/GetAuthorizeDevicesByFilter', { params })

/**
 *  获取设备基本信息
 */
export const fetchDeviceInfo = (deviceId: string) =>
  request.get(`/api/services/app/Devices/GetDeviceInfo?deviceId=${deviceId}`)

export const fetchDeviceInfoAll = (deviceId: string) =>
  request.get(`/api/services/app/DeviceAuthorize/GetDeviceInfo?deviceId=${deviceId}`)
interface ByCompany {
  /** 公司id */
  companyId: string
  keyword?: string
}
/**
 *  获取设备基本信息
 */
export const getAuthorizeDevicesByCompany = (params: ByCompany) =>
  request.get(`/api/services/app/DeviceAuthorize/GetAuthorizeDevicesByCompany`, { params })
