/**
 * Retention Service
 *
 * Provides complete player retention mechanics including:
 * - Achievement tracking and unlocking
 * - Daily login rewards with streaks
 * - Daily quests with progress tracking
 * - Player statistics and photo album
 */

// Achievements
export {
  ACHIEVEMENT_DEFINITIONS,
  getAchievementByKey,
  hasUnlockedAchievement,
  hasUnlockedAchievementAsync,
  unlockAchievement,
  unlockAchievementAsync,
  checkAndUnlock,
  checkAndUnlockAsync,
  checkAchievements,
  checkAchievementsAsync,
  getPlayerAchievements,
  getPlayerAchievementsAsync,
  getAchievementsByCategory,
  initializeAchievements,
  loadPlayerAchievements,
  clearPlayerAchievements,
  clearPlayerAchievementsAsync,
  clearAllAchievements,
  calculateTotalReward,
  getAchievementSummary,
  type AchievementDefinition,
  type AchievementCategory,
  type UnlockedAchievement,
  type PlayerAchievements,
  type PlayerStats,
  type EventData,
  type CollectionEntry,
  type CategorySummary,
  type AchievementSummary,
} from './achievements.js';

// Daily Rewards
export {
  getDailyReward,
  getAllRewards,
  checkDailyLogin,
  claimDailyReward,
  getDailyRewardState,
  getLoginStreakInfo,
  handleDailyLoginCheck,
  clearPlayerStreak,
  clearAllStreaks,
  initializeDailyRewards,
  ensureDailyRewardsTables,
  resetTodayClaim,
  type DailyReward,
  type DayReward,
  type LoginCheckResult,
  type ClaimResult,
  type LoginStreakInfo,
  type DailyRewardState,
} from './dailyRewards.js';

// Daily Quests
export {
  getQuestTemplate,
  generateDailyQuests,
  updateQuestProgress,
  getActiveQuests,
  formatQuestForClient,
  claimQuestReward,
  getQuestStatistics,
  handleDailyQuestCheck,
  clearPlayerQuests,
  clearAllQuests,
  getAllQuestTemplates,
  initializeQuestTemplates,
  ensureDailyQuestTables,
  enableDatabaseStorage,
  disableDatabaseStorage,
  isDatabaseStorageEnabled,
  // Quest chains + weekly challenges + streak bonus (deeper loop)
  getQuestChainStep,
  unlockQuestChain,
  isChainUnlocked,
  updateChainProgress,
  getWeeklyChallengeTemplates,
  getOrRollWeeklyChallenge,
  updateWeeklyChallengeProgress,
  recordFullClear,
  checkAndRecordFullClear,
  getFullClearStreak,
  getWeekKey,
  loadQuestEngagement,
  serializeQuestEngagement,
  STREAK_BONUS_THRESHOLD,
  STREAK_BONUS_REWARD,
  type QuestType,
  type QuestDifficulty,
  type QuestTemplate,
  type ActiveQuest,
  type QuestReward,
  type FormattedQuest,
  type QuestStatistics,
  type ClaimQuestResult,
  type QuestChainStep,
  type WeeklyChallengeTemplate,
  type ActiveWeeklyChallenge,
  type StreakBonusResult,
  type PersistedQuestEngagement,
} from './dailyQuests.js';

// Statistics
export {
  initializePlayerStatistics,
  incrementStat,
  updateStat,
  setBooleanStat,
  getPlayerStatistics,
  capturePhotoMemory,
  getPhotoAlbum,
  getPhotoAlbumCount,
  getPhotosByType,
  trackMoneyEarned,
  trackMoneySpent,
  trackRelationshipFormed,
  trackActivityCompleted,
  trackConversation,
  trackDeath,
  trackJobObtained,
  trackFired,
  trackChildBorn,
  trackFriendMade,
  trackDating,
  trackMarriage,
  trackJobLevel,
  trackAffinity,
  clearPlayerStatistics,
  clearAllStatistics,
  type StatName,
  type BooleanStatName,
  type PlayerStatistics,
  type PhotoMemory,
} from './statistics.js';

// Tutorial
export {
  // Core functions
  initializeTutorial,
  getTutorialState,
  isTutorialComplete,
  getCurrentStep,
  advanceTutorialStep,
  completeTutorial,
  skipTutorial,
  resetTutorial,

  // Tutorial mode detection (ported from Python is_tutorial_mode)
  isTutorialMode,

  // Tutorial modifiers (ported from Python apply_tutorial_modifiers)
  applyTutorialGameSpeedModifier,
  getTutorialGameSpeed,
  shouldPauseForTutorial,

  // Onboarding (ported from Python complete_onboarding)
  completeOnboarding,

  // Tooltip management (ported from Python mark_tooltip_seen)
  markTooltipShown,
  hasTooltipBeenShown,
  getUnshownTooltips,
  validateTooltipId,

  // Tutorial triggers (ported from Python check_tutorial_triggers)
  checkTutorialTriggers,
  getTutorialStateForPlayer,
  TUTORIAL_TRIGGERS,

  // WebSocket handlers
  handleTutorialAction,
  handleTutorialStepComplete,
  handleTooltipSeen,
  handleCompleteOnboarding,

  // Database operations
  initializeTutorialInDb,
  getTutorialProgressFromDb,
  updateTutorialStepInDb,
  markTooltipSeenInDb,
  completeOnboardingInDb,
  loadTutorialState,

  // Cleanup
  clearPlayerTutorial,
  clearAllTutorials,

  // Manager object
  tutorialManager,

  // Constants
  TUTORIAL_STEPS,
  TUTORIAL_COMPLETION_REWARD,
  ONBOARDING_COMPLETION_REWARD,
  TUTORIAL_MODE_HOURS,
  TUTORIAL_GAME_SPEED_MULTIPLIER,

  // Types
  type TutorialState,
  type TooltipConfig,
  type TutorialMessage,
  type TutorialActionMessage,
  type TutorialOperationResult,
  type TutorialTrigger,
} from './tutorial.js';

// Life Goals (forward-looking aspirations)
export {
  LIFE_GOAL_DEFINITIONS,
  ACTIVE_GOAL_SLATE_SIZE,
  getLifeGoalById,
  ageToLifeStage,
  buildGoalContext,
  refreshGoalSlate,
  evaluateGoals,
  getLifeScore,
  addLifeScore,
  setLifeScore,
  getPlayerLifeGoals,
  formatActiveGoals,
  formatCompletedGoals,
  loadPlayerLifeGoals,
  serializePlayerLifeGoals,
  clearPlayerLifeGoals,
  clearAllLifeGoals,
  type LifeStage,
  type LifeGoalDefinition,
  type LifeGoalProgress,
  type GoalEvalContext,
  type ActiveLifeGoal,
  type CompletedLifeGoal,
  type PlayerLifeGoals,
  type CompletedGoalResult,
  type FormattedLifeGoal,
} from './lifeGoals.js';

// Integration Helpers
export {
  sendAchievementUnlocked,
  sendAchievementsUnlocked,
  sendQuestProgress,
  initializePlayerRetention,
  onJobObtained,
  onPromotion,
  onFired,
  onMarriage,
  onDating,
  onAffinityMilestone,
  onChildBorn,
  onFriendMade,
  onBirthday,
  onPurchase,
  onConversationComplete,
  onDateNight,
  onMoneyEarned,
  onMoneySpent,
  onActivityCompleted,
  onWorkHours,
  onClassAttended,
  onAffinityIncrease,
  onGraduation,
  onStartSchool,
  onDeath,
  sendLifeGoalsUpdate,
  updateLifeGoals,
} from './integration.js';
