import {instanceRequest, request} from '@wisdom-utils/utils';

const REQUEST_METHOD_GET = 'get';
const REQUEST_METHOD_POST = 'post';
// eslint-disable-next-line no-undef
const baseUrl = typeof DUMI_TYPE !== 'undefined' && DUMI_TYPE === 'dumi' ? '/api' : '';

const monitorDeviceUrl = `${baseUrl}/PandaMonitor/Monitor/Device`;

// 获取单个设备的配置信息
export function getPointAddress(params) {
    return request({
        url: `${baseUrl}/PandaMonitor/Monitor/PointAddress/GetPointAddress`,
        method: REQUEST_METHOD_GET,
        params
    });
}

// 获取点表信息
export function getPointAddressEntry(params) {
    return request({
        url: `${baseUrl}/PandaMonitor/Monitor/PointAddress/GetPointAddressEntry`,
        method: REQUEST_METHOD_GET,
        params
    });
}

// 获取历史数据
export function getHistoryInfo(data) {
    return request({
        url: `${monitorDeviceUrl}/GetSensorsDataForStation`,
        method: REQUEST_METHOD_POST,
        data,
    });
}

// 获取指标报警方案配置
export function getDeviceAlarmScheme(option) {
    return request({
        url: `${monitorDeviceUrl}/GetDeviceAlarmScheme`,
        method: REQUEST_METHOD_POST,
        ...option,
    });
}

// 导出设备指标历史数据
export function getExportDeviceHistoryUrl(data) {
    return request({
        url: `${monitorDeviceUrl}/ExportDeviceHistoryInfo`,
        method: REQUEST_METHOD_POST,
        data,
    });
}

export function getDictionaryInfoAll(params) {
    return request({
        url: `${baseUrl}/PandaCore/GCK/Common/GetDictionaryInfoAll`,
        method: REQUEST_METHOD_GET,
        params
    })
}
export function searchDataDictionaryList (params) {
    return request({
        url: `${baseUrl}/PandaOMS/OMS/DataManger/SearchDataDictionaryList`,
        method: REQUEST_METHOD_GET,
        params
    })
}
export function getDataDictionaryList (params) {
    return request({
        url: `${baseUrl}/PandaOMS/OMS/DataManger/GetDataDictionaryList`,
        method: REQUEST_METHOD_GET,
        params
    })
}
export function getSensorType() {
    return request({
        url: `${baseUrl}/PandaMonitor/Monitor/Sensor/GetSensorType`,
        method: REQUEST_METHOD_GET,
    })
}

export function getPredicateSensor(params) {
    return request({
        url: `${monitorDeviceUrl}/GetPredicateSensor`,
        method: REQUEST_METHOD_GET,
        params
    })
}

// 获取统计数据
export function getStatisticsInfo(data) {
    return request({
        url: `${baseUrl}/PandaMonitor/Monitor/Device/EquipmentDataReport`,
        method: REQUEST_METHOD_POST,
        data,
    });
}

export function getSensorsRealName(data) {
    return request({
        url: `${baseUrl}/PandaMonitor/Monitor/Device/GetStaticRealName`,
        method: REQUEST_METHOD_POST,
        data,
    })
}
