import { pickByNotNull } from "@/plugins/utils";
import { $httpWithMsg } from "../../plugins/axios";
import { QUESTION_API } from "@/constants/constants";

export const statisticsQueryApi = (data) => {
  return $httpWithMsg.post(`${QUESTION_API}/course/page/question/count`, data);
};

export const statisticsExportApi = (data) => {
  return $httpWithMsg.post(
    `${QUESTION_API}/course/question/count_export`,
    pickByNotNull(data),
    {
      responseType: "blob",
    }
  );
};

export const questionTypeInfoApi = (courseId) => {
  return $httpWithMsg.post(
    `${QUESTION_API}/question/statistic/distribution`,
    {},
    {
      params: {
        courseId,
      },
    }
  );
};
export const questionDifficultInfoApi = (courseId) => {
  return $httpWithMsg.post(
    `${QUESTION_API}/question/statistic/difficult`,
    {},
    {
      params: {
        courseId,
      },
    }
  );
};

export const courseBlueInfoApi = (courseId) => {
  return $httpWithMsg.post(
    `${QUESTION_API}/question/statistic/property_distribution`,
    {},
    {
      params: {
        courseId,
      },
    }
  );
};

export const coursePaperInfoApi = (data) => {
  return $httpWithMsg.post(
    `${QUESTION_API}/course/page/paper/statistic`,
    {},
    {
      params: data,
    }
  );
};
