<?php

namespace App\Twig\Components;

use App\Repository\ChapterRepository;
use App\Repository\MangaRepository;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\DefaultActionTrait;

#[AsLiveComponent]
final class DownloadChapter
{
    use DefaultActionTrait;

    public ?string $mangaSlug = '';
    public float $chapter;

    public function __construct()
    {
    }

    public function downloadChapter(MangaRepository $mangaRepository, ChapterRepository $chapterRepository): int
    {
        //        $mangaSlug = $this->mangaSlug;
        //        $chapter = $this->chapter;
        //        $manga = $mangaRepository->findOneBy(['slug' => $mangaSlug]);
        //        $chapter = $chapterRepository->findOneBy(['manga' => $manga, 'number' => $chapter]);


        return 0;

    }
}
