import 'package:asciineverdie/src/core/model/skill.dart';

/// 게임 내 스킬 정의
///
/// PQ 스펠을 기반으로 68개 전투 스킬로 재구성
/// 스펠 이름(영문)으로 스킬 조회 가능
class SkillData {
  SkillData._();

  // ============================================================================
  // 공격 스킬 (Attack) - 18개
  // ============================================================================

  /// Stack Trace - 기본 공격 (빠른 쿨타임)
  static const stackTrace = Skill(
    id: 'stack_trace',
    name: 'Stack Trace',
    type: SkillType.attack,
    tier: 1,
    damageType: DamageType.physical,
    mpCost: 30, // T1 기본
    cooldownMs: 3000,
    power: 15,
    damageMultiplier: 2.0,
  );

  /// Core Dump - 중급 마법 공격 (메모리 덤프)
  static const coreDump = Skill(
    id: 'core_dump',
    name: 'Core Dump',
    type: SkillType.attack,
    tier: 3,
    damageType: DamageType.magical,
    mpCost: 135, // T3 × 1.5 (mult 3.0)
    cooldownMs: 12000,
    power: 30,
    damageMultiplier: 3.0,
  );

  /// Memory Dump - DOT 마법 공격
  static const memoryDump = Skill(
    id: 'memory_dump',
    name: 'Memory Dump',
    type: SkillType.attack,
    tier: 3,
    damageType: DamageType.magical,
    mpCost: 110, // T3 DOT (6틱 × 10dmg)
    cooldownMs: 15000,
    power: 0,
    element: SkillElement.memory,
    attackMode: AttackMode.dot,
    baseDotDamage: 10,
    baseDotDurationMs: 6000,
    baseDotTickMs: 1000,
  );

  /// Kernel Panic - 최강 마법 공격 (자해 데미지)
  static const kernelPanic = Skill(
    id: 'kernel_panic',
    name: 'Kernel Panic',
    type: SkillType.attack,
    tier: 5,
    damageType: DamageType.magical,
    mpCost: 300, // T5 × 2.0 (mult 4.0, 자해 보상)
    cooldownMs: 45000,
    power: 60,
    damageMultiplier: 4.0,
    selfDamagePercent: 0.1,
  );

  /// Blue Screen - 강력 마법 공격 (긴 쿨타임)
  static const blueScreen = Skill(
    id: 'blue_screen',
    name: 'Blue Screen',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.magical,
    mpCost: 210, // T4 × 1.75 (mult 3.5)
    cooldownMs: 30000,
    power: 50,
    damageMultiplier: 3.5,
  );

  /// Inject Code - 방어 무시 마법 공격
  static const injectCode = Skill(
    id: 'inject_code',
    name: 'Inject Code',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.magical,
    mpCost: 190, // T4 × 1.25 × 방감 1.25
    cooldownMs: 18000,
    power: 35,
    damageMultiplier: 2.5,
    targetDefReduction: 0.5,
  );

  /// Spawn Shell - 3연타 물리 공격
  static const spawnShell = Skill(
    id: 'spawn_shell',
    name: 'Spawn Shell',
    type: SkillType.attack,
    tier: 3,
    damageType: DamageType.physical,
    mpCost: 120, // T3 × 3타 보정 1.3
    cooldownMs: 10000,
    power: 12,
    damageMultiplier: 2.0,
    hitCount: 3,
  );

  /// Thread Pool - 5연타 물리 공격
  static const threadPool = Skill(
    id: 'thread_pool',
    name: 'Thread Pool',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.physical,
    mpCost: 230,
    cooldownMs: 15000,
    power: 10,
    damageMultiplier: 2.0,
    hitCount: 5,
  );

  /// Exfiltrate Data - HP 흡수 하이브리드 공격
  static const exfiltrateData = Skill(
    id: 'exfiltrate_data',
    name: 'Exfiltrate Data',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.hybrid,
    mpCost: 180,
    cooldownMs: 12000,
    power: 25,
    damageMultiplier: 2.0,
    lifestealPercent: 0.3,
  );

  /// Fuzzing - 랜덤 데미지 하이브리드 공격
  static const fuzzing = Skill(
    id: 'fuzzing',
    name: 'Fuzzing',
    type: SkillType.attack,
    tier: 2,
    damageType: DamageType.hybrid,
    mpCost: 100,
    cooldownMs: 8000,
    power: 20,
    damageMultiplier: 2.0,
    element: SkillElement.chaos,
  );

  /// Chaos Monkey - 랜덤 효과 하이브리드 공격
  static const chaosMonkey = Skill(
    id: 'chaos_monkey',
    name: 'Chaos Monkey',
    type: SkillType.attack,
    tier: 5,
    damageType: DamageType.hybrid,
    mpCost: 250,
    cooldownMs: 25000,
    power: 40,
    damageMultiplier: 3.2,
    element: SkillElement.chaos,
  );

  /// Saga Pattern - 3회 연속 물리 공격
  static const sagaPattern = Skill(
    id: 'saga_pattern',
    name: 'Saga Pattern',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.physical,
    mpCost: 280,
    cooldownMs: 20000,
    power: 18,
    damageMultiplier: 2.2,
    hitCount: 3,
  );

  /// Event Store - 차지 마법 공격 (DOT로 표현)
  static const eventStore = Skill(
    id: 'event_store',
    name: 'Event Store',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.magical,
    mpCost: 200,
    cooldownMs: 18000,
    power: 0,
    element: SkillElement.logic,
    attackMode: AttackMode.dot,
    baseDotDamage: 20,
    baseDotDurationMs: 3000,
    baseDotTickMs: 3000,
  );

  /// Auto Scale - HP비례 하이브리드 공격
  static const autoScale = Skill(
    id: 'auto_scale',
    name: 'Auto Scale',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.hybrid,
    mpCost: 230,
    cooldownMs: 20000,
    power: 30,
    damageMultiplier: 2.5,
  );

  /// Disassemble - 방어감소 + 물리 공격
  static const disassemble = Skill(
    id: 'disassemble',
    name: 'Disassemble',
    type: SkillType.attack,
    tier: 3,
    damageType: DamageType.physical,
    mpCost: 150,
    cooldownMs: 12000,
    power: 22,
    damageMultiplier: 2.0,
    targetDefReduction: 0.3,
  );

  /// Decompile - 약점 물리 공격 (높은 크리)
  static const decompile = Skill(
    id: 'decompile',
    name: 'Decompile',
    type: SkillType.attack,
    tier: 2,
    damageType: DamageType.physical,
    mpCost: 130,
    cooldownMs: 10000,
    power: 20,
    damageMultiplier: 2.2,
  );

  /// Canary Release - 테스트 물리 공격
  static const canaryRelease = Skill(
    id: 'canary_release',
    name: 'Canary Release',
    type: SkillType.attack,
    tier: 1,
    damageType: DamageType.physical,
    mpCost: 35, // T1 기본
    cooldownMs: 6000,
    power: 12,
    damageMultiplier: 2.0,
  );

  /// A/B Test - 이중 물리 공격
  static const abTest = Skill(
    id: 'ab_test',
    name: 'A/B Test',
    type: SkillType.attack,
    tier: 2,
    damageType: DamageType.physical,
    mpCost: 180,
    cooldownMs: 12000,
    power: 15,
    damageMultiplier: 2.0,
    hitCount: 2,
  );

  /// Pivot Network - 네트워크 마법 공격
  static const pivotNetwork = Skill(
    id: 'pivot_network',
    name: 'Pivot Network',
    type: SkillType.attack,
    tier: 3,
    damageType: DamageType.magical,
    mpCost: 150,
    cooldownMs: 10000,
    power: 25,
    damageMultiplier: 2.2,
    element: SkillElement.network,
  );

  /// Async Await - 딜레이 마법 공격
  static const asyncAwait = Skill(
    id: 'async_await',
    name: 'Async Await',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.magical,
    mpCost: 180,
    cooldownMs: 14000,
    power: 35,
    damageMultiplier: 3.0,
  );

  /// Event Source - DOT 마법 공격
  static const eventSource = Skill(
    id: 'event_source',
    name: 'Event Source',
    type: SkillType.attack,
    tier: 3,
    damageType: DamageType.magical,
    mpCost: 150,
    cooldownMs: 12000,
    power: 0,
    element: SkillElement.memory,
    attackMode: AttackMode.dot,
    baseDotDamage: 8,
    baseDotDurationMs: 8000,
    baseDotTickMs: 800,
  );

  /// CQRS Split - 분리 물리 공격
  static const cqrsSplit = Skill(
    id: 'cqrs_split',
    name: 'CQRS Split',
    type: SkillType.attack,
    tier: 4,
    damageType: DamageType.physical,
    mpCost: 200,
    cooldownMs: 15000,
    power: 20,
    damageMultiplier: 2.0,
    hitCount: 2,
  );

  // ============================================================================
  // 회복 스킬 (Heal) - 12개
  // ============================================================================

  /// Garbage Collection - 기본 HP 회복
  static const garbageCollection = Skill(
    id: 'garbage_collection',
    name: 'Garbage Collection',
    type: SkillType.heal,
    tier: 3,
    mpCost: 130,
    cooldownMs: 15000,
    power: 0,
    healPercent: 0.3,
  );

  /// Hot Reload - 즉시 회복 (짧은 쿨타임)
  static const hotReload = Skill(
    id: 'hot_reload',
    name: 'Hot Reload',
    type: SkillType.heal,
    tier: 1,
    mpCost: 80,
    cooldownMs: 8000,
    power: 0,
    healAmount: 30,
  );

  /// Rollback - HP 회복
  static const rollback = Skill(
    id: 'rollback',
    name: 'Rollback',
    type: SkillType.heal,
    tier: 4,
    mpCost: 150,
    cooldownMs: 18000,
    power: 0,
    healPercent: 0.35,
  );

  /// Hotfix - 긴급 회복 (낮은 MP)
  static const hotfix = Skill(
    id: 'hotfix',
    name: 'Hotfix',
    type: SkillType.heal,
    tier: 1,
    mpCost: 50,
    cooldownMs: 6000,
    power: 0,
    healAmount: 20,
  );

  /// Snapshot Restore - 대량 회복 (50% HP)
  static const snapshotRestore = Skill(
    id: 'snapshot_restore',
    name: 'Snapshot Restore',
    type: SkillType.heal,
    tier: 5,
    mpCost: 250,
    cooldownMs: 30000,
    power: 0,
    healPercent: 0.5,
  );

  /// Patch Binary - 회복+버프 (HP + DEF)
  static const patchBinary = Skill(
    id: 'patch_binary',
    name: 'Patch Binary',
    type: SkillType.heal,
    tier: 4,
    mpCost: 180,
    cooldownMs: 20000,
    power: 0,
    healPercent: 0.25,
    buff: BuffEffect(
      id: 'patch_binary_buff',
      name: 'Patched',
      durationMs: 8000,
      defModifier: 0.2,
    ),
  );

  /// Git Commit - HP 저장/회복
  static const gitCommit = Skill(
    id: 'git_commit',
    name: 'Git Commit',
    type: SkillType.heal,
    tier: 2,
    mpCost: 100,
    cooldownMs: 12000,
    power: 0,
    healPercent: 0.2,
  );

  /// Git Push - HP 복원
  static const gitPush = Skill(
    id: 'git_push',
    name: 'Git Push',
    type: SkillType.heal,
    tier: 3,
    mpCost: 130,
    cooldownMs: 15000,
    power: 0,
    healPercent: 0.25,
  );

  /// Connection Pool - MP 회복
  static const connectionPool = Skill(
    id: 'connection_pool',
    name: 'Connection Pool',
    type: SkillType.heal,
    tier: 3,
    mpCost: 0,
    cooldownMs: 20000,
    power: 0,
    mpHealAmount: 30,
  );

  /// Load Balance - HP/MP 균등화 (HP 회복)
  static const loadBalance = Skill(
    id: 'load_balance',
    name: 'Load Balance',
    type: SkillType.heal,
    tier: 4,
    mpCost: 100,
    cooldownMs: 15000,
    power: 0,
    healPercent: 0.2,
    mpHealAmount: 15,
  );

  /// Blue Green Deploy - HP/MP 스왑
  static const blueGreenDeploy = Skill(
    id: 'blue_green_deploy',
    name: 'Blue Green Deploy',
    type: SkillType.heal,
    tier: 4,
    mpCost: 150,
    cooldownMs: 25000,
    power: 0,
    healPercent: 0.3,
  );

  /// Cache Invalidate - 디버프 해제 (클렌즈)
  static const cacheInvalidate = Skill(
    id: 'cache_invalidate',
    name: 'Cache Invalidate',
    type: SkillType.heal,
    tier: 2,
    mpCost: 130,
    cooldownMs: 18000,
    power: 0,
    healAmount: 15,
  );

  // ============================================================================
  // 버프 스킬 (Buff) - 20개
  // ============================================================================

  /// Debug Mode - ATK +25%
  static const debugMode = Skill(
    id: 'debug_mode',
    name: 'Debug Mode',
    type: SkillType.buff,
    tier: 3,
    mpCost: 140, // 100 → 140
    cooldownMs: 20000,
    power: 0,
    buff: BuffEffect(
      id: 'debug_mode_buff',
      name: 'Debug Mode',
      durationMs: 8000, // 10초 → 8초
      atkModifier: 0.15, // 25% → 15%
    ),
  );

  /// Safe Mode - DEF 증가
  static const safeMode = Skill(
    id: 'safe_mode',
    name: 'Safe Mode',
    type: SkillType.buff,
    tier: 3,
    mpCost: 160, // 130 → 160
    cooldownMs: 25000,
    power: 0,
    buff: BuffEffect(
      id: 'safe_mode_buff',
      name: 'Safe Mode',
      durationMs: 8000, // 10초 → 8초
      defModifier: 0.18, // 30% → 18%
    ),
  );

  /// Memory Optimization - 전스탯 증가
  static const memoryOptimization = Skill(
    id: 'memory_optimization',
    name: 'Memory Optimization',
    type: SkillType.buff,
    tier: 3,
    mpCost: 180, // 150 → 180
    cooldownMs: 30000,
    power: 0,
    buff: BuffEffect(
      id: 'memory_optimization_buff',
      name: 'Optimized',
      durationMs: 12000, // 15초 → 12초
      atkModifier: 0.07, // 10% → 7%
      defModifier: 0.07, // 10% → 7%
      criRateModifier: 0.03, // 5% → 3%
      evasionModifier: 0.03, // 5% → 3%
    ),
  );

  /// Breakpoint - 크리율 증가 (하이브리드 밸런스)
  static const breakpoint = Skill(
    id: 'breakpoint',
    name: 'Breakpoint',
    type: SkillType.buff,
    tier: 2,
    mpCost: 120, // 70 → 120
    cooldownMs: 12000,
    power: 0,
    buff: BuffEffect(
      id: 'breakpoint_buff',
      name: 'Breakpoint',
      durationMs: 5000,
      criRateModifier: 0.20, // 35% → 20%
    ),
  );

  /// Watch Variable - 회피율 증가
  static const watchVariable = Skill(
    id: 'watch_variable',
    name: 'Watch Variable',
    type: SkillType.buff,
    tier: 2,
    mpCost: 120, // 90 → 120
    cooldownMs: 15000,
    power: 0,
    buff: BuffEffect(
      id: 'watch_variable_buff',
      name: 'Watching',
      durationMs: 6000, // 8초 → 6초
      evasionModifier: 0.12, // 20% → 12%
    ),
  );

  /// Step Into - 공격속도 증가 (ATK 버프로 표현)
  static const stepInto = Skill(
    id: 'step_into',
    name: 'Step Into',
    type: SkillType.buff,
    tier: 1,
    mpCost: 100, // 80 → 100
    cooldownMs: 12000,
    power: 0,
    buff: BuffEffect(
      id: 'step_into_buff',
      name: 'Step Into',
      durationMs: 6000,
      atkModifier: 0.12, // 20% → 12%
    ),
  );

  /// Profile Run - 크리율 증가
  static const profileRun = Skill(
    id: 'profile_run',
    name: 'Profile Run',
    type: SkillType.buff,
    tier: 3,
    mpCost: 150, // 100 → 150
    cooldownMs: 18000,
    power: 0,
    buff: BuffEffect(
      id: 'profile_run_buff',
      name: 'Profiling',
      durationMs: 6000, // 8초 → 6초
      criRateModifier: 0.18, // 30% → 18%
    ),
  );

  /// Benchmark - 데미지 증가
  static const benchmark = Skill(
    id: 'benchmark',
    name: 'Benchmark',
    type: SkillType.buff,
    tier: 4,
    mpCost: 180, // 130 → 180
    cooldownMs: 20000,
    power: 0,
    buff: BuffEffect(
      id: 'benchmark_buff',
      name: 'Benchmarking',
      durationMs: 5000,
      atkModifier: 0.25, // 40% → 25%
    ),
  );

  /// Elevate Privilege - 전스탯 증가 (하이브리드 밸런스)
  static const elevatePrivilege = Skill(
    id: 'elevate_privilege',
    name: 'Elevate Privilege',
    type: SkillType.buff,
    tier: 5,
    mpCost: 280, // 220 → 280
    cooldownMs: 35000,
    power: 0,
    buff: BuffEffect(
      id: 'elevate_privilege_buff',
      name: 'Elevated',
      durationMs: 6000, // 8초 → 6초
      atkModifier: 0.08, // 12% → 8%
      defModifier: 0.08, // 12% → 8%
      criRateModifier: 0.04, // 6% → 4%
      evasionModifier: 0.04, // 6% → 4%
    ),
  );

  /// Scale Up - ATK 증가 (하이브리드 밸런스)
  static const scaleUp = Skill(
    id: 'scale_up',
    name: 'Scale Up',
    type: SkillType.buff,
    tier: 5,
    mpCost: 280, // 220 → 280
    cooldownMs: 30000,
    power: 0,
    buff: BuffEffect(
      id: 'scale_up_buff',
      name: 'Scaled Up',
      durationMs: 5000, // 6초 → 5초
      atkModifier: 0.20, // 30% → 20%
    ),
  );

  /// Failover - DEF 증가 (하이브리드 밸런스)
  static const failover = Skill(
    id: 'failover',
    name: 'Failover',
    type: SkillType.buff,
    tier: 5,
    mpCost: 350, // 300 → 350
    cooldownMs: 45000,
    power: 0,
    buff: BuffEffect(
      id: 'failover_buff',
      name: 'Failover Ready',
      durationMs: 15000, // 20초 → 15초
      defModifier: 0.18, // 25% → 18%
    ),
  );

  /// Containerize - 방어막 (DEF 증가)
  static const containerize = Skill(
    id: 'containerize',
    name: 'Containerize',
    type: SkillType.buff,
    tier: 3,
    mpCost: 170, // 130 → 170
    cooldownMs: 20000,
    power: 0,
    buff: BuffEffect(
      id: 'containerize_buff',
      name: 'Containerized',
      durationMs: 10000, // 12초 → 10초
      defModifier: 0.20, // 35% → 20%
    ),
  );

  /// Orchestrate - 복합 버프
  static const orchestrate = Skill(
    id: 'orchestrate',
    name: 'Orchestrate',
    type: SkillType.buff,
    tier: 4,
    mpCost: 260, // 230 → 260
    cooldownMs: 40000,
    power: 0,
    buff: BuffEffect(
      id: 'orchestrate_buff',
      name: 'Orchestrated',
      durationMs: 8000, // 10초 → 8초
      atkModifier: 0.10, // 15% → 10%
      defModifier: 0.10, // 15% → 10%
      criRateModifier: 0.06, // 10% → 6%
    ),
  );

  /// Promise Resolve - 버프 즉시 발동
  static const promiseResolve = Skill(
    id: 'promise_resolve',
    name: 'Promise Resolve',
    type: SkillType.buff,
    tier: 2,
    mpCost: 130, // 100 → 130
    cooldownMs: 15000,
    power: 0,
    buff: BuffEffect(
      id: 'promise_resolve_buff',
      name: 'Resolved',
      durationMs: 6000, // 8초 → 6초
      atkModifier: 0.15, // 25% → 15%
    ),
  );

  /// Feature Toggle - 버프 on/off
  static const featureToggle = Skill(
    id: 'feature_toggle',
    name: 'Feature Toggle',
    type: SkillType.buff,
    tier: 1,
    mpCost: 110, // 80 → 110
    cooldownMs: 10000,
    power: 0,
    buff: BuffEffect(
      id: 'feature_toggle_buff',
      name: 'Toggled',
      durationMs: 10000, // 12초 → 10초
      atkModifier: 0.10, // 15% → 10%
      defModifier: 0.10, // 15% → 10%
    ),
  );

  /// Dark Launch - 은신 (하이브리드 밸런스)
  static const darkLaunch = Skill(
    id: 'dark_launch',
    name: 'Dark Launch',
    type: SkillType.buff,
    tier: 4,
    mpCost: 180, // 150 → 180
    cooldownMs: 30000,
    power: 0,
    buff: BuffEffect(
      id: 'dark_launch_buff',
      name: 'Hidden',
      durationMs: 3000,
      evasionModifier: 0.20, // 30% → 20%
    ),
  );

  /// Static Analysis - 적 스탯 확인 (크리 증가)
  static const staticAnalysis = Skill(
    id: 'static_analysis',
    name: 'Static Analysis',
    type: SkillType.buff,
    tier: 1,
    mpCost: 100, // 80 → 100
    cooldownMs: 12000,
    power: 0,
    buff: BuffEffect(
      id: 'static_analysis_buff',
      name: 'Analyzed',
      durationMs: 8000, // 10초 → 8초
      criRateModifier: 0.10, // 15% → 10%
    ),
  );

  /// Dynamic Analysis - 크리+회피
  static const dynamicAnalysis = Skill(
    id: 'dynamic_analysis',
    name: 'Dynamic Analysis',
    type: SkillType.buff,
    tier: 4,
    mpCost: 170, // 130 → 170
    cooldownMs: 18000,
    power: 0,
    buff: BuffEffect(
      id: 'dynamic_analysis_buff',
      name: 'Dynamic',
      durationMs: 6000, // 8초 → 6초
      criRateModifier: 0.10, // 15% → 10%
      evasionModifier: 0.10, // 15% → 10%
    ),
  );

  /// Reverse Engineer - ATK 증가
  static const reverseEngineer = Skill(
    id: 'reverse_engineer',
    name: 'Reverse Engineer',
    type: SkillType.buff,
    tier: 4,
    mpCost: 190, // 150 → 190
    cooldownMs: 25000,
    power: 0,
    buff: BuffEffect(
      id: 'reverse_engineer_buff',
      name: 'Reversed',
      durationMs: 8000, // 10초 → 8초
      atkModifier: 0.18, // 30% → 18%
    ),
  );

  /// Cover Tracks - 회피 증가
  static const coverTracks = Skill(
    id: 'cover_tracks',
    name: 'Cover Tracks',
    type: SkillType.buff,
    tier: 2,
    mpCost: 130, // 100 → 130
    cooldownMs: 15000,
    power: 0,
    buff: BuffEffect(
      id: 'cover_tracks_buff',
      name: 'Covered',
      durationMs: 5000,
      evasionModifier: 0.15, // 25% → 15%
    ),
  );

  /// Deploy - 분신 소환 (ATK 증가로 표현)
  static const deploy = Skill(
    id: 'deploy',
    name: 'Deploy',
    type: SkillType.buff,
    tier: 4,
    mpCost: 220, // 180 → 220
    cooldownMs: 30000,
    power: 0,
    buff: BuffEffect(
      id: 'deploy_buff',
      name: 'Deployed',
      durationMs: 10000, // 12초 → 10초
      atkModifier: 0.22, // 35% → 22%
    ),
  );

  /// Retry Logic - 미스 방지 (크리 증가로 표현)
  static const retryLogic = Skill(
    id: 'retry_logic',
    name: 'Retry Logic',
    type: SkillType.buff,
    tier: 2,
    mpCost: 130, // 100 → 130
    cooldownMs: 15000,
    power: 0,
    buff: BuffEffect(
      id: 'retry_logic_buff',
      name: 'Retrying',
      durationMs: 8000, // 10초 → 8초
      criRateModifier: 0.12, // 20% → 12%
    ),
  );

  /// State Machine - 상태 전이 (복합 버프)
  static const stateMachine = Skill(
    id: 'state_machine',
    name: 'State Machine',
    type: SkillType.buff,
    tier: 2,
    mpCost: 170, // 150 → 170
    cooldownMs: 25000,
    power: 0,
    buff: BuffEffect(
      id: 'state_machine_buff',
      name: 'State Active',
      durationMs: 12000, // 15초 → 12초
      atkModifier: 0.08, // 10% → 8%
      defModifier: 0.08, // 10% → 8%
    ),
  );

  // ============================================================================
  // 디버프 스킬 (Debuff) - 12개
  // ============================================================================

  /// Step Over - 적 속도 -30% (적 ATK 감소로 표현)
  static const stepOver = Skill(
    id: 'step_over',
    name: 'Step Over',
    type: SkillType.debuff,
    tier: 1,
    mpCost: 100,
    cooldownMs: 15000,
    power: 0,
    buff: BuffEffect(
      id: 'step_over_debuff',
      name: 'Slowed',
      durationMs: 5000,
      atkModifier: -0.3,
    ),
  );

  /// Cold Boot - 적 동결 (2초 스턴 → DEF 감소로 표현)
  static const coldBoot = Skill(
    id: 'cold_boot',
    name: 'Cold Boot',
    type: SkillType.debuff,
    tier: 4,
    mpCost: 150,
    cooldownMs: 25000,
    power: 0,
    buff: BuffEffect(
      id: 'cold_boot_debuff',
      name: 'Frozen',
      durationMs: 3000,
      defModifier: -0.5,
      atkModifier: -0.5,
    ),
  );

  /// Heap Analysis - 적 DEF -20%
  static const heapAnalysis = Skill(
    id: 'heap_analysis',
    name: 'Heap Analysis',
    type: SkillType.debuff,
    tier: 2,
    mpCost: 130,
    cooldownMs: 18000,
    power: 0,
    buff: BuffEffect(
      id: 'heap_analysis_debuff',
      name: 'Analyzed',
      durationMs: 8000,
      defModifier: -0.2,
    ),
  );

  /// Unit Test - 버그 발견 (취약)
  static const unitTest = Skill(
    id: 'unit_test',
    name: 'Unit Test',
    type: SkillType.debuff,
    tier: 1,
    mpCost: 100,
    cooldownMs: 15000,
    power: 0,
    buff: BuffEffect(
      id: 'unit_test_debuff',
      name: 'Bug Found',
      durationMs: 10000,
      defModifier: -0.15,
    ),
  );

  /// Integration Test - 연계 취약점
  static const integrationTest = Skill(
    id: 'integration_test',
    name: 'Integration Test',
    type: SkillType.debuff,
    tier: 2,
    mpCost: 130,
    cooldownMs: 18000,
    power: 0,
    buff: BuffEffect(
      id: 'integration_test_debuff',
      name: 'Integration Bug',
      durationMs: 8000,
      defModifier: -0.2,
      atkModifier: -0.1,
    ),
  );

  /// Sanitizer - 적 버프 해제 (ATK/DEF 감소로 표현)
  static const sanitizer = Skill(
    id: 'sanitizer',
    name: 'Sanitizer',
    type: SkillType.debuff,
    tier: 3,
    mpCost: 60,
    cooldownMs: 20000,
    power: 0,
    buff: BuffEffect(
      id: 'sanitizer_debuff',
      name: 'Sanitized',
      durationMs: 6000,
      atkModifier: -0.25,
      defModifier: -0.25,
    ),
  );

  /// Hook Function - 다음 공격 반사 (DEF 증가로 표현)
  static const hookFunction = Skill(
    id: 'hook_function',
    name: 'Hook Function',
    type: SkillType.debuff,
    tier: 2,
    mpCost: 50,
    cooldownMs: 22000,
    power: 0,
    buff: BuffEffect(
      id: 'hook_function_debuff',
      name: 'Hooked',
      durationMs: 5000,
      atkModifier: -0.3,
    ),
  );

  /// Rate Limit - 적 공격속도 -50%
  static const rateLimit = Skill(
    id: 'rate_limit',
    name: 'Rate Limit',
    type: SkillType.debuff,
    tier: 3,
    mpCost: 60,
    cooldownMs: 25000,
    power: 0,
    buff: BuffEffect(
      id: 'rate_limit_debuff',
      name: 'Rate Limited',
      durationMs: 6000,
      atkModifier: -0.4,
    ),
  );

  /// Circuit Break - 적 스킬 봉인 (ATK 대폭 감소)
  static const circuitBreak = Skill(
    id: 'circuit_break',
    name: 'Circuit Break',
    type: SkillType.debuff,
    tier: 4,
    mpCost: 70,
    cooldownMs: 30000,
    power: 0,
    buff: BuffEffect(
      id: 'circuit_break_debuff',
      name: 'Circuit Broken',
      durationMs: 5000,
      atkModifier: -0.5,
    ),
  );

  /// Backpressure - 데미지 반사 30% (적 ATK 감소로 표현)
  static const backpressure = Skill(
    id: 'backpressure',
    name: 'Backpressure',
    type: SkillType.debuff,
    tier: 2,
    mpCost: 50,
    cooldownMs: 20000,
    power: 0,
    buff: BuffEffect(
      id: 'backpressure_debuff',
      name: 'Pressured',
      durationMs: 10000,
      atkModifier: -0.2,
    ),
  );

  /// Git Merge - 충돌 유발 (혼란)
  static const gitMerge = Skill(
    id: 'git_merge',
    name: 'Git Merge',
    type: SkillType.debuff,
    tier: 2,
    mpCost: 40,
    cooldownMs: 15000,
    power: 0,
    buff: BuffEffect(
      id: 'git_merge_debuff',
      name: 'Merge Conflict',
      durationMs: 3000,
      atkModifier: -0.3,
      defModifier: -0.2,
    ),
  );

  // ============================================================================
  // 스펠 이름 → 스킬 매핑
  // ============================================================================

  /// PQ 스펠 이름으로 스킬 조회
  ///
  /// 스펠 이름(영문)을 키로 사용하여 해당 전투 스킬을 반환
  static const Map<String, Skill> spellNameToSkill = {
    // 공격 스킬
    'Stack Trace': stackTrace,
    'Core Dump': coreDump,
    'Memory Dump': memoryDump,
    'Kernel Panic': kernelPanic,
    'Blue Screen': blueScreen,
    'Inject Code': injectCode,
    'Spawn Shell': spawnShell,
    'Thread Pool': threadPool,
    'Exfiltrate Data': exfiltrateData,
    'Fuzzing': fuzzing,
    'Chaos Monkey': chaosMonkey,
    'Saga Pattern': sagaPattern,
    'Event Store': eventStore,
    'Auto Scale': autoScale,
    'Disassemble': disassemble,
    'Decompile': decompile,
    'Canary Release': canaryRelease,
    'A/B Test': abTest,
    'Pivot Network': pivotNetwork,
    'Async Await': asyncAwait,
    'Event Source': eventSource,
    'CQRS Split': cqrsSplit,

    // 회복 스킬
    'Garbage Collection': garbageCollection,
    'Hot Reload': hotReload,
    'Rollback': rollback,
    'Hotfix': hotfix,
    'Snapshot Restore': snapshotRestore,
    'Patch Binary': patchBinary,
    'Git Commit': gitCommit,
    'Git Push': gitPush,
    'Connection Pool': connectionPool,
    'Load Balance': loadBalance,
    'Blue Green Deploy': blueGreenDeploy,
    'Cache Invalidate': cacheInvalidate,

    // 버프 스킬
    'Debug Mode': debugMode,
    'Safe Mode': safeMode,
    'Memory Optimization': memoryOptimization,
    'Breakpoint': breakpoint,
    'Watch Variable': watchVariable,
    'Step Into': stepInto,
    'Profile Run': profileRun,
    'Benchmark': benchmark,
    'Elevate Privilege': elevatePrivilege,
    'Scale Up': scaleUp,
    'Failover': failover,
    'Containerize': containerize,
    'Orchestrate': orchestrate,
    'Promise Resolve': promiseResolve,
    'Feature Toggle': featureToggle,
    'Dark Launch': darkLaunch,
    'Static Analysis': staticAnalysis,
    'Dynamic Analysis': dynamicAnalysis,
    'Reverse Engineer': reverseEngineer,
    'Cover Tracks': coverTracks,
    'Deploy': deploy,
    'Retry Logic': retryLogic,
    'State Machine': stateMachine,

    // 디버프 스킬
    'Step Over': stepOver,
    'Cold Boot': coldBoot,
    'Heap Analysis': heapAnalysis,
    'Unit Test': unitTest,
    'Integration Test': integrationTest,
    'Sanitizer': sanitizer,
    'Hook Function': hookFunction,
    'Rate Limit': rateLimit,
    'Circuit Break': circuitBreak,
    'Backpressure': backpressure,
    'Git Merge': gitMerge,
  };

  // ============================================================================
  // 스킬 목록
  // ============================================================================

  /// 모든 스킬 목록
  static List<Skill> get allSkills => spellNameToSkill.values.toList();

  /// 기본 스킬 ID 목록 (SpellBook이 비어있을 때 사용)
  static List<String> get defaultSkillIds => const [
    'stack_trace', // 기본 공격
    'garbage_collection', // 기본 회복
  ];

  /// DOT 스킬 목록
  static List<Skill> get dotSkills => allSkills.where((s) => s.isDot).toList();

  /// ID로 스킬 찾기
  static Skill? getSkillById(String id) {
    for (final skill in allSkills) {
      if (skill.id == id) return skill;
    }
    return null;
  }

  /// 스펠 이름으로 스킬 찾기
  static Skill? getSkillBySpellName(String spellName) {
    return spellNameToSkill[spellName];
  }

  /// 타입별 스킬 목록
  static List<Skill> getSkillsByType(SkillType type) {
    return allSkills.where((s) => s.type == type).toList();
  }

  /// 공격 스킬 목록 (MP 효율순 정렬)
  static List<Skill> get attackSkillsByEfficiency {
    final attacks = getSkillsByType(SkillType.attack);
    attacks.sort((a, b) => b.mpEfficiency.compareTo(a.mpEfficiency));
    return attacks;
  }

  /// 회복 스킬 목록
  static List<Skill> get healSkills => getSkillsByType(SkillType.heal);

  /// 버프 스킬 목록
  static List<Skill> get buffSkills => getSkillsByType(SkillType.buff);

  /// 디버프 스킬 목록
  static List<Skill> get debuffSkills => getSkillsByType(SkillType.debuff);

  /// MP 비용 이하의 사용 가능한 공격 스킬
  static List<Skill> getAffordableAttackSkills(int currentMp) {
    return getSkillsByType(
      SkillType.attack,
    ).where((s) => s.mpCost <= currentMp).toList();
  }
}
