<?php
declare(strict_types=1);

namespace App\Modules\Cron;

use App\Modules\Automation\OrderStatusAgedService;

final class OrderStatusAgedHandler
{
    public function __construct(private readonly OrderStatusAgedService $service)
    {
    }

    /**
     * @param array<string, mixed> $payload
     * @return array<string, mixed>
     */
    public function handle(array $payload): array
    {
        $triggered = $this->service->scan();

        return [
            'ok' => true,
            'triggered_count' => $triggered,
        ];
    }
}
