<?php
/**
 * BookiFlex Core
 *
 * @package    BookiFlex
 * @subpackage Core
 * @author     BookiFlex
 * @copyright  Copyright (c) 2025 BookiFlex
 * @license    GPL-2.0-or-later
 *
 * @link       https://bookiflex.com
 */

declare(strict_types=1);

namespace BookiFlex\Extensions\Reservation\Job;

use BookiFlex\Core\Contract\Queue\QueueJobInterface;
use BookiFlex\Core\Service\Reservation\ReservationStatusManager;

defined( 'ABSPATH' ) || exit;

/**
 * Queue job for checking and updating overdue reservations
 *
 * This job runs periodically to find reservations that have exceeded their
 * payment waiting period and marks them as overdue.
 */
class CheckOverdueReservationsJob implements QueueJobInterface
{
	public const HOOK = 'bookiflex_check_overdue_reservations';

    public function __construct(
        private readonly ReservationStatusManager $statusManager
    ) {
    }

    public function handle(array $args): void
    {
        $this->statusManager->checkOverdue();
    }

    public function getHook(): string
    {
        return self::HOOK;
    }

    public function getMaxAttempts(): int
    {
        return 3;
    }
}