import {
  GET_SITES_SYSTEM_STATUS_API,
  GET_SITES_SYSTEM_ENERGY_COST_RANK_API,
  GET_SITES_SYSTEM_ENERGY_COST_TREND_API,
  GET_SITES_SYSTEM_ENERGY_COST_GROWTH_API,
  GET_USER_API,
} from "./api";
import instance from "@/util/request";
import apihandler from "@/util/apihandler";

export const getSystemStatus = async (building_ids) => {
  const res = await instance.post(GET_SITES_SYSTEM_STATUS_API, building_ids);

  return apihandler(res.code, res.data, {
    msg: res.msg,
    code: res.code,
  });
};

export const getSystemEnergyCostRank = async (building_ids) => {
  const res = await instance.post(GET_SITES_SYSTEM_ENERGY_COST_RANK_API, building_ids);

  return apihandler(res.code, res.data, {
    msg: res.msg,
    code: res.code,
  });
};

export const getSystemEnergyCostTrend = async (building_ids) => {
  const res = await instance.post(GET_SITES_SYSTEM_ENERGY_COST_TREND_API, building_ids);

  return apihandler(res.code, res.data, {
    msg: res.msg,
    code: res.code,
  });
}

export const getSystemEnergyCostGrowth = async (building_ids) => {
  const res = await instance.get(GET_SITES_SYSTEM_ENERGY_COST_GROWTH_API, building_ids);

  return apihandler(res.code, res.data, {
    msg: res.msg,
    code: res.code,
  });
}

export const getUserList = async (params = {}) => {

  const res = await instance.post(GET_USER_API, {});

  return apihandler(res.code, res.data, {
    msg: res.msg,
    code: res.code,
  });
}