import HTTP              from '@/request/alova';
import { processMethod } from '@/request/api/flow.api';


export function uploadFileMethod(file: File) {
  const formData = new FormData();
  formData.append('file', file);
  return HTTP.Post<{ name: string; url: string }>(`/file/upload`, formData, {});
}

export function saveFileMethod(params: Record<string, string>) {
  return HTTP.Get(`/fdhb-tablet/patientInfoManage/saveTonguefaceImg`, {
    params,
    async transform(data: string, headers) {
      const path = await processMethod(`/camera`);
      return {
        resultId: data,
        route: path ? { path } : {
          path: '/camera/result',
          query: { to: `/screen` },
        },
      };
    },
  });
}
