/**
 * TabataFit Animation System
 * Liquid Glass — fluid, organic motion
 */

import { Easing } from 'react-native'

// ═══════════════════════════════════════════════════════════════════════════
// DURATIONS
// ═══════════════════════════════════════════════════════════════════════════

export const DURATION = {
  INSTANT: 100,
  FAST: 200,
  NORMAL: 300,
  SLOW: 500,
  XSLOW: 800,

  // Special
  BREATH: 2500,      // Breathing animation cycle
  BREATH_HALF: 1250, // Half breath cycle
  LIQUID: 600,       // Liquid morph duration
  RIPPLE: 400,       // Tap ripple
  PHASE_CHANGE: 300, // Phase transition
} as const

// ═══════════════════════════════════════════════════════════════════════════
// EASING CURVES
// ═══════════════════════════════════════════════════════════════════════════

export const EASE = {
  // Standard iOS easing
  DEFAULT: Easing.bezier(0.25, 0.1, 0.25, 1),
  EASE_OUT: Easing.bezier(0, 0, 0.2, 1),
  EASE_IN: Easing.bezier(0.4, 0, 1, 1),
  EASE_IN_OUT: Easing.bezier(0.4, 0, 0.2, 1),

  // Liquid / Fluid
  LIQUID: Easing.bezier(0.4, 0, 0.2, 1),
  BOUNCE: Easing.bezier(0.68, -0.55, 0.265, 1.55),

  // Sharp / Snappy
  SNAPPY: Easing.bezier(0.2, 0, 0, 1),
} as const

// ═══════════════════════════════════════════════════════════════════════════
// SPRING CONFIGS (for react-native Animated.spring)
// ═══════════════════════════════════════════════════════════════════════════

export const SPRING = {
  // Bouncy (playful)
  BOUNCY: {
    damping: 15,
    stiffness: 180,
    mass: 1,
  },

  // Gentle (smooth)
  GENTLE: {
    damping: 20,
    stiffness: 100,
    mass: 1,
  },

  // Snappy (quick)
  SNAPPY: {
    damping: 18,
    stiffness: 300,
    mass: 1,
  },

  // Slow (dramatic)
  SLOW: {
    damping: 25,
    stiffness: 80,
    mass: 1.5,
  },

  // Liquid (fluid)
  LIQUID: {
    damping: 20,
    stiffness: 200,
    mass: 1,
  },
} as const

// ═══════════════════════════════════════════════════════════════════════════
// PRESET ANIMATION CONFIGS
// ═══════════════════════════════════════════════════════════════════════════

export const ANIMATION = {
  // Fade in
  FADE_IN: {
    duration: DURATION.NORMAL,
    easing: EASE.EASE_OUT,
  },

  // Scale up (pop in)
  POP_IN: {
    spring: SPRING.BOUNCY,
  },

  // Slide up
  SLIDE_UP: {
    duration: DURATION.NORMAL,
    easing: EASE.EASE_OUT,
  },

  // Liquid morph
  LIQUID_MORPH: {
    duration: DURATION.LIQUID,
    easing: EASE.LIQUID,
  },

  // Breathing glow
  BREATHE: {
    duration: DURATION.BREATH,
    easing: EASE.EASE_IN_OUT,
  },

  // Timer tick pulse
  TIMER_TICK: {
    duration: 150,
    easing: EASE.EASE_OUT,
  },

  // Phase transition
  PHASE_TRANSITION: {
    duration: DURATION.PHASE_CHANGE,
    easing: EASE.EASE_IN_OUT,
  },
} as const
