import { useUserInfo } from '@/hooks/data/useUserInfo';
import { useCheckinSubmit } from '@/hooks/data/useCheckinSubmit';
import { CheckinScannerNavView } from './checkin-scanner-nav.view';

export function CheckinScannerNavContainer() {
  const { data } = useUserInfo();
  const { mutate, isPending } = useCheckinSubmit();

  if ((data.data?.permission_level ?? 0) <= 20) {
    return null;
  }

  return (
    <CheckinScannerNavView
      onScan={(code) => mutate({ body: { checkin_code: code } })}
      isPending={isPending}
    />
  );
}
