"use client"

import { useParams } from 'next/navigation';

import ChatMessages from '@/components/consultation/ChatMessages';

export default function ConversationPage() {

    const params = useParams();
    const consultationId = params.consultationId

    if (!params) {
        return (
            <div className="flex-1 flex items-center justify-center">
                <p>Loading conversation...</p>
            </div>
        );
    }
    return (
        <>
            {params.consultationId ? (
                <ChatMessages consultationId={consultationId} />
            ) : (
                <div className="flex items-center justify-center h-full">
                    <p>Select a conversation to start chatting</p>
                </div>
            )}
        </>
    );
}