<?php

namespace apexl\Io\modules\admin;

use apexl\Io\includes\Hook;
use apexl\Io\modules\admin\controllers\configurationController;
use apexl\Io\modules\user\classes\userManagedApiModule;
use apexl\Io\modules\user\services\Permissions;

class adminModule extends userManagedApiModule{
    public function __construct()
    {
        parent::__construct();
    }

    public function routes()
    {
        //Add Configuration Routes
        $this->addProtectedAdminActionRoute('PUT', 'admin.configuration.ad.update', 'configuration/allowed-domains', configurationController::class.':updateAllowedDomains', 'ManageConfiguration');
        $this->addProtectedAdminActionRoute('PUT', 'admin.configuration.installation.update', 'configuration/installation', configurationController::class.':updateInstallation', 'ManageConfiguration');
        $this->addProtectedAdminActionRoute('PUT', 'admin.configuration.sessions.update', 'configuration/sessions', configurationController::class.':updateSessions', 'ManageConfiguration');
        $this->addProtectedAdminActionRoute('PUT', 'admin.configuration.email.update', 'configuration/email', configurationController::class.':updateEmail', 'ManageConfiguration');
        $this->addProtectedAdminActionRoute('PUT', 'admin.configuration.site.update', 'configuration/site', configurationController::class.':updateSite', 'ManageConfiguration');
        $this->addProtectedAdminActionRoute('PUT', 'admin.configuration.databases.update', 'configuration/databases', configurationController::class.':updateDatabases', 'ManageConfiguration');
        $this->addProtectedAdminActionRoute('PUT', 'admin.configuration.metadata.update', 'configuration/meta-data', configurationController::class.':updateMetadata', 'ManageConfiguration');

        //Add System Routes
    }

    public function registerPermissions(Permissions $permissions)
    {
        $permissions->registerPermission('administer', 'Access Administration', 'Admin');
        $permissions->registerPermission('ManageConfiguration', 'Manage Configuration', 'Admin');
    }
}