'use client';

import { useState } from 'react';

import DoctorConsultationWindow from '@/components/Dashboard/doctor/ConsultationWindow';
import GeneralConsultationList from '@/components/Dashboard/doctor/GeneralConsultationList';
import PendingCalloutsList from '@/components/Dashboard/doctor/PendingCalloutsList';
import { useAuthStore } from '@/stores/authStore';

export default function DoctorConsultationsPage() {
  const [selectedConsultation, setSelectedConsultation] = useState(null);

  const userData = useAuthStore((state) => state.user);

  const doctorId = userData?.id || null;

  return (
    <main className="p-4 space-y-6">
      {!userData?.profile?.isVerified ? (
        <div className="bg-yellow-100 text-yellow-800 border border-yellow-300 p-4 rounded text-center">
          <p className="text-sm font-medium">
            Your profile is not yet verified. Please complete the verification process to access consultations and related features.
          </p>
        </div>
      ) : (
        <>
          <GeneralConsultationList
            onSelect={setSelectedConsultation}
            currentDoctorId={doctorId}
          />
          <PendingCalloutsList />
          <DoctorConsultationWindow />
        </>
      )}
    </main>
  );
}
