import {
  useMutation,
  UseMutationOptions,
  useQuery,
  UseQueryOptions,
} from '@tanstack/react-query';
import { getUser } from '../requests';

async function mockSignIn() {
  return Promise.resolve(true);
}

export function useSignIn(options?: UseMutationOptions) {
  return useMutation(mockSignIn, options as any);
}

async function mockSignOut() {
  return Promise.resolve(true);
}

export function useSignOut(options?: UseMutationOptions) {
  return useMutation(mockSignOut, options as any);
}

export function useUser(options?: UseQueryOptions<{ userId: string }>) {
  return useQuery(['user-info'], getUser, options);
}
