require('../config/loadEnv')();

const rewardReadinessService = require('../services/rewardReadinessService');

const status = rewardReadinessService.getStatus();
const permit = status.liveCanaryPermit || {};
const result = {
  ok: Boolean(permit.ok),
  mode: 'reward-live-canary-permit',
  readinessStatus: status.status,
  readinessScore: status.readinessScore,
  permit,
  checkedAt: new Date().toISOString()
};

console.log(JSON.stringify(result, null, 2));

if (!result.ok) process.exitCode = 1;
