<?php
namespace OxygenApp\Hooks;

use OxygenApp\Views\Admin\Settings\MainSettings;
use OxygenApp\Views\Admin\Users\Dashboard;
use OxygenApp\Config\Config;

if ( ! defined( 'ABSPATH' ) ) exit;

class ActionAdminMenu implements IHook {

    static function register() {
        add_action('admin_menu', [self::class, 'adminMenuHandler']);
    }

    static function adminMenuHandler(): void {
        $mainSettings = new MainSettings();
        $mainSettingsPageSlug = Config::getInstance()->getSetting('main_settings_page_slug', '');
        add_menu_page(esc_html__('OxyleafApp Settings', 'oxyleaf-app-working-and-relaxing-app'), esc_html__('OxyleafApp Settings', 'oxyleaf-app-working-and-relaxing-app'), 
        'manage_options', $mainSettingsPageSlug, [$mainSettings, 'render'], NULL, 81);

        $dashboardPage = new Dashboard();
        $usersPageSlug = Config::getInstance()->getSetting('users_dashboard_page_slug', '');
        add_menu_page(esc_html__('OxyleafApp Users', 'oxyleaf-app-working-and-relaxing-app'), esc_html__('OxyleafApp Users', 'oxyleaf-app-working-and-relaxing-app'), 
        'manage_options', $usersPageSlug, [$dashboardPage, 'render'], NULL, 81);
    }
}