import { Canvas } from "@react-three/fiber";
import { OrbitControls, Stage, useGLTF } from "@react-three/drei";

type ModelViewerProps = {
  fileUrl: string;
};

export const ModelViewer = ({ fileUrl }: ModelViewerProps) => {
  const { scene } = useGLTF(fileUrl);

  return (
    <Canvas style={{ width: "100%", height: "80vh" }}>
      <ambientLight />
      <directionalLight />
      <Stage environment="city" intensity={0.6}>
        <primitive object={scene} />
      </Stage>
      <OrbitControls />
    </Canvas>
  );
};
