<?php

namespace App\Jobs;

use App\Services\PayrollService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class GeneratePayrollJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function __construct(
        public int $companyId,
        public int $year,
        public int $month
    ) {}

    public function handle(PayrollService $payrollService): void
    {
        $payrollService->generate($this->companyId, $this->year, $this->month);
    }
}
