<?php

namespace App\Controller\Admin;

use App\Entity\Section;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Entity\User;
use App\Entity\Blog;
use App\Entity\Comment;


/**
 * Class DashboardController
 * @package App\Controller\Admin
 */
class DashboardController extends AbstractDashboardController
{
    #[Route('/admin', name: 'admin')]
    public function index(): Response
    {
        return parent::index();
    }

    public function configureDashboard(): Dashboard
    {
        return Dashboard::new()
            ->setTitle('24unix');
    }

    public function configureMenuItems(): iterable
    {
	    yield MenuItem::linktoRoute('Back to the website', 'fas fa-home', 'blogs');
	    yield MenuItem::linktoDashboard('Dashboard', 'fas fa-tachometer-alt');
	    yield MenuItem::linkToCrud('User', 'fas fa-user', User::class);
	    yield MenuItem::linkToCrud('Sections', 'fas fa-book', Section::class);
	    yield MenuItem::linkToCrud('Blogs', 'fas fa-blog', Blog::class);
	    yield MenuItem::linkToCrud('Comments', 'fas fa-comments', Comment::class);
    }
}
