<?php

namespace Apexl\Io\Modules;

use Apexl\Io\Interfaces\ProvidesHooksInterface;
use Apexl\Io\Module;
use Apexl\Io\System\Controllers\GetGlobalDataController;
use Apexl\Io\System\Controllers\GetRoutesController;
use Apexl\Io\System\Hooks\AddMiddleware;
use Apexl\Io\System\Hooks\ConsoleCommands;
use Apexl\Io\System\Interfaces\ProvidesRoutesInterface;

/**
 * Base module file, provides required methods to register things like routes and middleware.
 * Class installModule
 * @package apexl\Io\modules\install
 */
readonly class SystemModule extends Module implements ProvidesHooksInterface, ProvidesRoutesInterface
{
    public function routes(): void
    {
        //Get global data
        $this->get('/system/globalData', GetGlobalDataController::class)
            ->setName('system.globaldata');

        //get all available routes
        $this->get('/system/routes', GetRoutesController::class)
            ->setName('system.routes');
    }

    public function hooks(): array
    {
        return [
            ConsoleCommands::class,
            AddMiddleware::class,
        ];
    }
}
