<?php

namespace Apexl\Io\Display;

use Apexl\Io\Display\Controllers\DashboardController;
use Apexl\Io\Display\Hooks\RedirectFollowingEntityDeleteHook;
use Apexl\Io\Display\Hooks\SetDefaultRenderDisplaysHook;
use Apexl\Io\Interfaces\ProvidesHooksInterface;
use Apexl\Io\Module;
use Apexl\Io\System\Interfaces\ProvidesRoutesInterface;
use Apexl\Io\User\Enums\Permissions\Common;
use Apexl\Io\User\Middleware\RoutePermissionMiddleware;

readonly class DisplayModule extends Module implements ProvidesHooksInterface, ProvidesRoutesInterface
{
    public function routes(): void
    {
        $this->get('/', DashboardController::class)
            ->setName('home')
            ->add(new RoutePermissionMiddleware(Common::IS_LOGGED_IN));
    }

    public function hooks(): array
    {
        return [
            SetDefaultRenderDisplaysHook::class,
            RedirectFollowingEntityDeleteHook::class,
        ];
    }
}
