import request from '@/utils/request';

/**
 *
 * @param sn 循环题组sn
 * @param params 可选的页数信息
 */
export function analysisInsights(sn: string, params?: ParticalParams) {
  return request({
    url: `/console/surveys/${sn}/analysis_insights_h5`,
    data: {},
    method: 'post'
  });
}

/**
 * ai 洞察检查分析是否完成
 * @param sn 循环题组sn
 * @param data {1|2}   1=AI样本标记;2=AI洞察
 */
export function checkAnalysisStatus(sn: string, data?: 1 | 2) {
  return request({
    url: `/console/surveys/${sn}/status`,
    method: 'post',
    data: {
      type: data
    }
  });
}

/**
 * 问题分析接口
 * @param sn
 * @param data {import('@/api/types/analysis.js').AnalysisParam}
 * @returns {Promise<axios.AxiosResponse<any>> | *}
 */
export function getAnalysis(sn: string) {
  return request({
    url: `/console/surveys/${sn}/chart_analysis`,
    method: 'post',
    data: {}
  });
}
