"use client";
import { useSearchParams } from "next/navigation";
import { LiveRoomPage } from "@/components/live/LiveRoomPage";

interface Props {
  params: { id: string };
}

export default function LiveRoomRoute({ params }: Props) {
  const { id } = params;
  const searchParams = useSearchParams();
  const isHost = searchParams.get("host") === "true";
  const isDummy = searchParams.get("dummy") === "true";

  if (isDummy) {
    return (
      <div className="fixed inset-0 bg-black flex flex-col items-center justify-center gap-4" style={{ zIndex: 600 }}>
        <div className="text-5xl">📡</div>
        <p className="text-white/60 text-sm text-center max-w-xs">
          Demo stream — not available in live mode.
        </p>
        <a
          href="/live"
          className="px-5 py-2.5 rounded-xl text-sm font-bold text-white"
          style={{ background: "rgba(220,38,38,0.8)" }}
        >
          Back to Live
        </a>
      </div>
    );
  }

  return <LiveRoomPage callId={id} isHost={isHost} />;
}
