<?php

namespace App\Jobs;

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

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

    protected $timelogs;

    public function __construct($timelogs)
    {
        $this->timelogs = $timelogs;
    }

    public function handle()
    {
        foreach ($this->timelogs as $timelog) {
            Timelog::create($timelog);
        }
    }
}
