'use client'
// src/components/three/_Scene.tsx
// Input: children ReactNode (scene objects), autoRotate bool
// Output: r3f Canvas with ambient+directional lights, OrbitControls, Suspense
// Rationale: actual canvas implementation — imported only via SceneWrapper (ssr:false)

import { Suspense } from 'react'
import { Canvas } from '@react-three/fiber'
import { OrbitControls, Environment } from '@react-three/drei'

export interface SceneProps {
  children?: React.ReactNode
  autoRotate?: boolean
  autoRotateSpeed?: number
  enableInteraction?: boolean
}

export default function Scene({
  children,
  autoRotate = false,
  autoRotateSpeed = 0.5,
  enableInteraction = true,
}: SceneProps) {
  return (
    <Canvas
      camera={{ position: [3, 2, 5], fov: 45, near: 0.1, far: 200 }}
      gl={{ antialias: true, alpha: true }}
      style={{ background: 'transparent' }}
    >
      <Suspense fallback={null}>
        {/* Lighting */}
        <ambientLight intensity={0.6} />
        <directionalLight position={[5, 8, 4]} intensity={1.2} />
        <directionalLight position={[-4, -2, -4]} intensity={0.3} color="#3DB8E8" />

        {/* Scene content */}
        {children}

        <OrbitControls
          enableZoom={enableInteraction}
          enablePan={false}
          enableRotate={enableInteraction}
          autoRotate={autoRotate}
          autoRotateSpeed={autoRotateSpeed}
          dampingFactor={0.08}
          enableDamping
        />
      </Suspense>
    </Canvas>
  )
}
