/**
 * Context for animation settings panels (used by Pro CountUp extension).
 */

import { createContext, useContext } from "react";
import type { AnimationSettings } from "@/types";

export interface AnimationSettingsContextValue {
  animation: AnimationSettings;
  onUpdate: (animation: AnimationSettings) => void;
  compact: boolean;
  onCountUpCodeChanged?: () => void;
}

export const AnimationSettingsContext = createContext<AnimationSettingsContextValue | null>(null);

export function useAnimationSettingsContext(): AnimationSettingsContextValue {
  const context = useContext(AnimationSettingsContext);
  if (!context) {
    throw new Error("useAnimationSettingsContext must be used within AnimationSettingsContext.Provider");
  }
  return context;
}
