import { type UseMutationOptions, useMutation } from 'react-query';

import { editPartialSession } from 'src/pages/dashboard/Learning/Sessions/services';
import { type RequestError, type RequestSuccess } from 'src/types/services';

import { type EditPartialSessionData } from '../types';

export type TData = RequestSuccess<typeof editPartialSession>;
export type TError = RequestError;
export type TValues = EditPartialSessionData;

export const useEditPartialSession = (
  options?: UseMutationOptions<TData, TError, TValues>,
) => {
  return useMutation<TData, TError, TValues>({
    mutationFn: editPartialSession,
    ...options,
  });
};
