"use server";

// import { serverFetchBlob } from "@/app/utils/fetchUtil";
// import { BASE_API_URL } from "@/config/api";
import { serverFetchBlob } from "../../utils/fetchUtil";
import { BASE_API_URL } from "../../../config/api";

export interface FileResponse {
  filename: string;
  blobValue: Uint8Array;
}

export const fetchPoQrcode = async (data: any) => {
  const reportBlob = await serverFetchBlob<FileResponse>(
    `${BASE_API_URL}/stockInLine/print-label`,
    {
      method: "POST",
      body: JSON.stringify(data),
      headers: { "Content-Type": "application/json" },
    },
  );

  return reportBlob;
};
export interface LotLineToQrcode {
  inventoryLotLineId: number
}
export const fetchQrCodeByLotLineId = async (data: LotLineToQrcode) => {
    const reportBlob = await serverFetchBlob<FileResponse>(
    `${BASE_API_URL}/inventoryLotLine/print-label`,
    {
      method: "POST",
      body: JSON.stringify(data),
      headers: { "Content-Type": "application/json" },
    },
  );

  return reportBlob;
}
