<?php

namespace App\Jobs;

use App\Models\Transcript;
use App\Services\Meet\MeetAiService;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;

class GenerateAiSummary implements ShouldQueue
{
    use Queueable;

    public function __construct(
        public int $transcriptId,
    ) {}

    public function handle(MeetAiService $ai): void
    {
        $transcript = Transcript::find($this->transcriptId);
        if (! $transcript) {
            return;
        }

        $ai->summarize($transcript);
    }
}
