'use client';
import { useParams } from 'next/navigation';
import { Stack } from '@mui/material';
import { BookingDetailView } from '@/components/booking';
import { BookingSupportEntry } from '@/components/messaging';
import NurseVisitNotesPanel from './NurseVisitNotesPanel';

/**
 * Nurse booking detail (`/nurse/visits/{id}`) — the both-roles view in the **nurse** shell, where the
 * assigned nurse gets the per-session EVV check-in/out controls and the gated care-instructions card
 * (two-stage disclosure). Below the EVV surface, the f13 append-only visit-note panel lets the nurse tick
 * today's task checklist, write a note, and read the patient's continuity history. Reached from the ویزیت
 * امروز day surface.
 */
export default function NurseBookingDetailPage() {
  const params = useParams<{ id: string }>();
  const id = Number(params.id);
  const bookingId = Number.isInteger(id) && id > 0 ? id : -1;

  return (
    <Stack sx={{ gap: 3 }}>
      <BookingDetailView bookingId={bookingId} viewerRole="nurse" />
      {bookingId > 0 && <BookingSupportEntry bookingId={bookingId} role="nurse" />}
      {bookingId > 0 && <NurseVisitNotesPanel bookingId={bookingId} />}
    </Stack>
  );
}
