<?php
// includes/cron-runtime.php

if (!defined('ABSPATH')) exit;

if (!defined('ASANA_AUTOMATOR_CRON_HOOK')) {
    define('ASANA_AUTOMATOR_CRON_HOOK', 'asana_automator_cron_dispatch');
}

/* ── custom 5-minute schedule ─────────────────────────────── */
add_filter('cron_schedules', static function ($schedules) {
    $schedules['five_minutes'] = $schedules['five_minutes'] ?? [
        'interval' => 300,
        'display'  => 'Every 5 Minutes',
    ];
    return $schedules;
});

/* ── attach dispatcher when wp-cron fires ─────────────────── */
if ( ! has_action(ASANA_AUTOMATOR_CRON_HOOK, 'asana_automator_dispatch_rules') ) {
    add_action(ASANA_AUTOMATOR_CRON_HOOK, 'asana_automator_dispatch_rules');
}
