<?php

namespace App\Jobs;

use App\Services\DailySummaryService;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;

class RebuildDailySummaries implements ShouldQueue
{
    use Queueable;

    public function __construct(
        public readonly string $date,
        public readonly ?int $companyId = null,
        public readonly ?int $branchId = null,
    ) {
    }

    public function handle(DailySummaryService $dailySummaryService): void
    {
        $dailySummaryService->rebuildForDate($this->date, $this->companyId, $this->branchId);
    }
}
