import { EntityWorkflow } from "ChillMainAssets/types";
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";

export const fetchWorkflow = async (
  workflowId: number,
): Promise<EntityWorkflow> => {
  try {
    return await makeFetch<null, EntityWorkflow>(
      "GET",
      `/api/1.0/main/workflow/${workflowId}.json`,
    );
  } catch (error) {
    console.error(`Failed to fetch workflow ${workflowId}:`, error);
    throw error;
  }
};
