import { UseMutationOptions, useMutation } from "@tanstack/react-query";
import {
  TDataSourceContext,
  TDataSourceError,
  TDataSourceRecord,
  TDataSourceVariables,
} from "./types";

export function useSave<
  TData extends TDataSourceRecord = TDataSourceRecord,
  TError extends TDataSourceError = TDataSourceError,
  TVariables extends TDataSourceVariables = TDataSourceVariables,
  TContext extends TDataSourceContext = TDataSourceContext
>(options: UseMutationOptions<TData, TError, TVariables, TContext>) {
  return useMutation<TData, TError, TVariables, TContext>({
    ...options,
  });
}
