<?php

namespace App\Classes\Jobs;

use App\Classes\Modules\Accounting\Processors\CreateBankStatementTransactionOwnersProcessor;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class CreateBankStatementTransactionOwners implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    private $transactions;

    public function __construct($transactions) {
        $this->transactions = $transactions;
    }
    
    public function handle()
    {
        (App()->make(CreateBankStatementTransactionOwnersProcessor::class))->execute($this->transactions);
    }

    public function delay($delay)
    {
        // Add delay in seconds to the job
        $this->delay = $delay;
        return $this;
    }
}
