import { ref } from 'vue';
import { api } from 'src/boot/axios';
import { defineStore } from 'pinia';

import axios from 'axios';

const useOcr = defineStore('useOcrStore', () => {
  const baseUrl = import.meta.env.VITE_API_BASE_URL_OCR;

  async function sendOcr(
    payload: {
      file: File;
    },
    flow?: {
      sessionId?: string;
      refTransactionId?: string;
      transactionId?: string;
    },
  ) {
    const res = await axios
      .post(`${baseUrl}/`, payload.file, {
        headers: { 'Content-Type': payload.file?.type },
        onUploadProgress: (e) => console.log(e),
      })
      .catch((e) => console.error(e));
    // ]);
  }

  return {
    sendOcr,
  };
});

export default useOcr;
