require('../config/loadEnv')();
const ledgerDbReadinessService = require('../services/ledgerDbReadinessService');

const status = ledgerDbReadinessService.getStatus();

console.log(JSON.stringify({
  targetBackend: status.targetBackend,
  score: status.score,
  canAttachWriter: status.canAttachWriter,
  canSwitchReads: status.canSwitchReads,
  dbUriConfigured: status.dbUriConfigured,
  driverAvailable: status.driverAvailable,
  shadowConsistent: status.shadowConsistent,
  dryRunReady: status.dryRunReady,
  rollbackReady: status.rollbackReady,
  switchLockReason: status.switchLockReason,
  checks: status.checks.map((check) => ({
    key: check.key,
    ok: check.ok,
    severity: check.severity,
    detail: check.detail
  }))
}, null, 2));

