import request from '@/utils/request.js';

export function getQuestionList(params) {
  return request({
    url: '/console/template/h5_shortcut',
    method: 'get',
    params
  });
}
export function consoleSurveys(params) {
  return request({
    url: '/console/surveys',
    method: 'post',
    data: params
  });
}

export function getSurveysPage(params) {
  return request({
    url: '/console/surveys',
    method: 'get',
    params
  });
}

// 复制问卷
export function copySurveys(sn) {
  // source=1 表明是移动端问卷
  return request({
    url: `/console/surveys/${sn}?source=1`,
    method: 'post'
  });
}
// 复制问卷
export function deleteSurveys(sn) {
  return request({
    url: `/console/surveys/${sn}`,
    method: 'delete'
  });
}
export function getListScene(params) {
  return request({
    url: 'console/h5_scene',
    method: 'get',
    params
  });
}
//
export function getSurveyTemplates(params) {
  return request({
    url: '/console/survey_templates',
    method: 'get',
    params
  });
}

export function useTemplate(sn, params) {
  return request({
    url: `console/templates/${sn}`,
    method: 'post',
    data: params
  });
}
export function deleteTemplate(sn) {
  return request({
    url: `/console/templates/${sn}`,
    method: 'delete'
  });
}
// 保存为模板
export function saveTemplates(sn, data) {
  return request({
    url: `/console/surveys/${sn}/templates`,
    method: 'post',
    data
  });
}

/**
 *  获取推荐列表
 * @returns { import('src/api/types/response').HotSearchResponse}
 */
export function hotSearch() {
  return request({
    url: `/console/hot_search/list`,
    method: 'post',
  });
}
