import { cronJobs } from 'convex/server';

import { internal } from './_generated/api';

// Cron order: Minute Hour DayOfMonth Month DayOfWeek
const crons = cronJobs();
crons.interval(
  'Refresh due GitHub Spoons',
  { hours: 1 },
  internal.githubSync.refreshDueSpoons,
  {
    limit: 10,
  },
);
/* Example cron jobs
crons.cron(
  // Run at 7:00 AM CST / 8:00 AM CDT
  // Only on weekdays
  'Schedule Automatic Lunches',
  '0 13 * * 1-5',
  api.statuses.automaticLunch,
);
crons.cron(
  // Run at 4:00 PM CST / 5:00 PM CDT
  // Only on weekdays
  'End of shift (weekdays 5pm CT)',
  '0 22 * * 1-5',
  api.statuses.endOfShiftUpdate,
);
*/
export default crons;
