import HTTP                                  from '../alova';
import { fromReportData, fromSchemeRequest } from '../model';


export function getReportMethod(id: string) {
  const params = { healthAnalysisReportId: id };
  return HTTP.Get(`/fdhb-tablet/analysisManage/getHealRepDetailById`, {
    params,
    transform(data, headers) { return fromReportData(<any> data); },
  });
}

export function updateReportMethod(id: string, data: Record<string, any>) {
  const params = {
    healthAnalysisReportId: id,
    constitutionGroupImg: data?.constitutionGroupImg,
    factorItemRadarImg: data?.factorItemRadarImg,
  };
  return HTTP.Post(`/fdhb-tablet/analysisManage/upConFacImgById`, params, {});
}

export function getReportSchemeMethod(id: string) {
  const params = { healthAnalysisReportId: id };
  return HTTP.Get(`/fdhb-tablet/analysisManage/getCondProgDetailById`, {
    params,
    transform(data: any, headers) {
      return fromSchemeRequest(data);
    },
  });
}
