import { Vector3 } from '@babylonjs/core';

const TARGET = new Vector3(0, 3.0, 0);

export function resetCamera(camera) {
  if (!camera) return;
  camera.alpha = -1.15;
  camera.beta = 1.12;
  camera.radius = 8.5;
  camera.setTarget(TARGET);
}

export function applyViewPreset(camera, preset) {
  if (!camera) return;
  switch (preset) {
    case 'front':
      camera.alpha = -Math.PI / 2; camera.beta = Math.PI / 2; camera.radius = 9; break;
    case 'rear':
      camera.alpha = Math.PI / 2; camera.beta = Math.PI / 2; camera.radius = 9; break;
    case 'medial':
      camera.alpha = Math.PI; camera.beta = Math.PI / 2; camera.radius = 9; break;
    case 'lateral':
      camera.alpha = 0; camera.beta = Math.PI / 2; camera.radius = 9; break;
    case 'top':
      camera.alpha = -Math.PI / 2; camera.beta = 0.02; camera.radius = 10; break;
    case 'fit':
      camera.alpha = -1.15; camera.beta = 1.12; camera.radius = 7.3; break;
    case 'reset':
    default:
      resetCamera(camera); break;
  }
  camera.setTarget(TARGET);
}