import request from '@/utils/request.js';
export function snQuestions(params) {
  return request({
    url: `/console/surveys/${params.sn}/questions`,
    method: 'get'
  });
}
// 操作编辑
export function saveQuestion(params) {
  return request({
    url: `console/surveys/${params.sn}/questions`,
    method: 'post',
    data: params
  });
}
export function sync(params) {
  return request({
    url: `console/surveys/${params.sn}/sync`,
    method: 'get'
  });
}
export function saveQuestions(params) {
  // let sn = params.sn;
  // delete params.sn;
  return request({
    url: `console/surveys/${params.sn}/details`,
    method: 'post',
    data: params
  });
}

// 获取setting
export function getSetting(params) {
  return request({
    url: `/console/surveys/${params.sn}/answer_setting`,
    method: 'get'
  });
}
export function saveSettings(params) {
  return request({
    url: `/console/surveys/${params.sn}/answer_setting`,
    method: 'put',
    data: params
  });
}
export function saveProjectName(sn, params) {
  return request({
    url: `/console/surveys/${sn}/project_name`,
    method: 'PATCH',
    data: params
  });
}

export function getSurveyTemplate(sn, params) {
  return request({
    url: `/answer/surveys/${sn}`,
    method: 'get',
    params
  });
}

export function getSurveysDetail(sn, params) {
  return request({
    url: `/console/surveys/${sn}`,
    method: 'get',
    params
  });
}

export function changeStatus(params) {
  return request({
    url: `/console/surveys/${params.sn}/status`,
    method: 'PATCH',
    data: params
  });
}
