import * as THREE from 'three'

export class LightingManager {
  static setupLighting(scene: THREE.Scene): void {
    // Ambient light for general illumination
    const ambientLight = new THREE.AmbientLight(0x404040, 0.3)
    scene.add(ambientLight)

    // Key light (main studio light)
    const keyLight = new THREE.DirectionalLight(0xffffff, 1.2)
    keyLight.position.set(10, 10, 5)
    keyLight.castShadow = true
    keyLight.shadow.mapSize.width = 2048
    keyLight.shadow.mapSize.height = 2048
    keyLight.shadow.camera.near = 0.1
    keyLight.shadow.camera.far = 50
    keyLight.shadow.camera.left = -10
    keyLight.shadow.camera.right = 10
    keyLight.shadow.camera.top = 10
    keyLight.shadow.camera.bottom = -10
    scene.add(keyLight)

    // Fill light (softer, opposite side)
    const fillLight = new THREE.DirectionalLight(0x8888ff, 0.4)
    fillLight.position.set(-8, 5, 3)
    scene.add(fillLight)

    // Rim light (for edge definition)
    const rimLight = new THREE.DirectionalLight(0xffaa88, 0.6)
    rimLight.position.set(0, -10, -5)
    scene.add(rimLight)

    // Point lights for additional atmosphere
    const pointLight1 = new THREE.PointLight(0x4444ff, 0.5, 30)
    pointLight1.position.set(-5, 5, 10)
    scene.add(pointLight1)

    const pointLight2 = new THREE.PointLight(0xff4444, 0.3, 25)
    pointLight2.position.set(5, -5, -8)
    scene.add(pointLight2)

    // Purple backlight for atmospheric effect
    const purpleBacklight = new THREE.DirectionalLight(0x8844ff, 0.8)
    purpleBacklight.position.set(0, 0, -15)
    purpleBacklight.target.position.set(0, 0, 0)
    scene.add(purpleBacklight)
    scene.add(purpleBacklight.target)
  }
}
