<?php

namespace MintyPHP\Module\Bookmarks\Service;

class BookmarkServicesFactory
{
    private ?BookmarkService $bookmarkService = null;

    public function __construct(
        private readonly BookmarkRepositoryFactory $bookmarkRepositoryFactory
    ) {
    }

    public function createBookmarkService(): BookmarkService
    {
        return $this->bookmarkService ??= new BookmarkService(
            $this->bookmarkRepositoryFactory->createBookmarkRepository(),
            $this->bookmarkRepositoryFactory->createBookmarkGroupRepository(),
            $this->bookmarkRepositoryFactory->createBookmarkNavigationRepository()
        );
    }
}
