<?php

declare(strict_types=1);

namespace App\Jobs\Paynl;

use App\Models\Merchant;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

final class FetchTerminals implements ShouldQueue
{
    use Dispatchable;
    use InteractsWithQueue;
    use Queueable;
    use SerializesModels;

    public function handle(): void
    {
        foreach (Merchant::query()->get() as $merchant) {
            FetchTerminalsForMerchant::dispatch($merchant);
        }
    }
}
