import type { ISourceOptions } from "@tsparticles/engine";

/**
 * Rain — intensity 0–100 → count 200–600, speed 15–30
 * Fast-falling blue-white circles. At this speed the motion itself
 * reads as rain streaks — no elongated shape needed.
 */
export function getRainConfig(intensity: number): ISourceOptions {
  const count = Math.round(200 + (intensity / 100) * 400);
  const speed = 15 + (intensity / 100) * 15;
  return {
    fullScreen: { enable: true, zIndex: 9997 },
    particles: {
      number: { value: count, density: { enable: false } },
      color: { value: "#aad4f5" },
      shape: { type: "circle" },
      opacity: { value: { min: 0.4, max: 0.75 } },
      size: { value: { min: 1, max: 2.5 } },
      move: {
        enable: true,
        speed: speed,
        direction: "bottom",
        straight: true,
        outModes: { default: "out" },
      },
    },
    interactivity: { events: { onClick: { enable: false }, onHover: { enable: false } } },
  };
}

/**
 * Embers — intensity 0–100 → count 20–80, speed 0.5–2
 * Slow-drifting warm amber dots with flickering opacity.
 * Clearly slower and dimmer than fire — different mood entirely.
 */
export function getEmbersConfig(intensity: number): ISourceOptions {
  const count = Math.round(20 + (intensity / 100) * 60);
  const speed = 0.5 + (intensity / 100) * 1.5;
  return {
    fullScreen: { enable: true, zIndex: 9997 },
    particles: {
      number: { value: count, density: { enable: false } },
      color: { value: ["#ff8800", "#ffaa00", "#ffcc44", "#ff6600"] },
      shape: { type: "circle" },
      opacity: {
        value: { min: 0.15, max: 0.9 },
        animation: { enable: true, speed: 0.6, sync: false, startValue: "random" },
      },
      size: { value: { min: 1.5, max: 4 } },
      move: {
        enable: true,
        speed: speed,
        direction: "top",
        random: true,
        straight: false,
        outModes: { default: "out" },
      },
    },
    interactivity: { events: { onClick: { enable: false }, onHover: { enable: false } } },
  };
}
