import cron from 'node-cron';
import { runLicenseExpiryCheck } from '../middleware/license-kill-switch';

export function startLicenseExpiryCron(): void {
  cron.schedule('59 23 * * *', async () => {
    console.log('Running license expiry check (23:59)...');
    try {
      const r = await runLicenseExpiryCheck();
      console.log('License expiry check done:', r);
    } catch (e) {
      console.error('License expiry check failed', e);
    }
  });
}
