<?php

namespace App\Manager\Toolbar\Factory;

use App\Manager\Toolbar\Definition\ActivityToolbar;
use App\Manager\Toolbar\Definition\ChapterListToolbar;
use App\Manager\Toolbar\Definition\MangaListToolbar;
use App\Manager\Toolbar\Definition\ScraperListToolbar;
use App\Manager\Toolbar\Definition\Toolbar;

class ToolbarFactory
{
    public function createToolbar(string $type, array $context = []): Toolbar
    {
        return match ($type) {
            'manga_list' => new MangaListToolbar(),
            'chapter_list' => new ChapterListToolbar($context),
            'activity' => new ActivityToolbar($context),
            'scraper_list' => new ScraperListToolbar($context),
            default => throw new \InvalidArgumentException("Unknown toolbar type: $type"),
        };
    }
}
