<?php

namespace MintyPHP\Module\Bookmarks;

use MintyPHP\App\AppContainer;
use MintyPHP\App\Container\ContainerRegistrar;
use MintyPHP\Module\Bookmarks\Repository\BookmarkGroupRepository;
use MintyPHP\Module\Bookmarks\Repository\BookmarkNavigationRepository;
use MintyPHP\Module\Bookmarks\Repository\BookmarkRepository;
use MintyPHP\Module\Bookmarks\Service\BookmarkService;

final class BookmarksContainerRegistrar implements ContainerRegistrar
{
    public function register(AppContainer $container): void
    {
        $container->set(BookmarkRepository::class, static fn (): BookmarkRepository => new BookmarkRepository());
        $container->set(BookmarkGroupRepository::class, static fn (): BookmarkGroupRepository => new BookmarkGroupRepository());
        $container->set(BookmarkNavigationRepository::class, static fn (): BookmarkNavigationRepository => new BookmarkNavigationRepository());

        $container->set(BookmarkService::class, static fn (AppContainer $c): BookmarkService => new BookmarkService(
            $c->get(BookmarkRepository::class),
            $c->get(BookmarkGroupRepository::class),
            $c->get(BookmarkNavigationRepository::class)
        ));
    }
}
