import type { GameState, Era } from '@ai-tycoon/shared'; import { ERA_THRESHOLDS } from '@ai-tycoon/shared'; export function checkEraTransition(state: GameState): Era | null { const current = state.meta.currentEra; const eraOrder: Era[] = ['startup', 'scaleup', 'bigtech', 'agi']; const currentIdx = eraOrder.indexOf(current); const nextEra = eraOrder[currentIdx + 1]; if (!nextEra) return null; const thresholds = ERA_THRESHOLDS[nextEra as keyof typeof ERA_THRESHOLDS]; if (!thresholds) return null; const bestModel = state.models.bestDeployedModelScore; if ( state.economy.totalRevenue >= thresholds.revenue && bestModel >= thresholds.capability && state.reputation.score >= thresholds.reputation ) { return nextEra; } return null; }