/**
 * EditorViewport
 * Composes the 3D scene and its overlay controls so the model canvas stays
 * interactive while camera and visual tools float above it.
 */
import Controls from '../model/Controls';
import Scene3D from '../model/Scene3D';
import VisualTools from '../model/VisualTools';

export default function EditorViewport({ state, actions, refs }) {
  return (
    <div className="relative w-full h-full bg-slate-950 overflow-hidden">
      <div className="absolute inset-0 z-0">
        <Scene3D
          modelUrl={state.modelUrl}
          textureUrl={state.textureUrl}
          lightIntensity={state.lightIntensity?.[0] ?? 0.5}
          lightAngle={state.lightAngle?.[0] ?? 0}
          controlsRef={refs.controlsRef}
          isAutoRotate={state.isAutoRotate}
          visualSettings={state.visualSettings}
        />
      </div>

      <div className="absolute inset-0 z-10 pointer-events-none">
        <div className="h-full w-full relative">
          <Controls 
            onRotate={actions.rotateModel} 
            onReset={actions.resetView} 
          />
          <VisualTools state={state} actions={actions} />
        </div>
      </div>
    </div>
  );
}