<?php
namespace FuseCommerce\Hooks;


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

use FuseCommerce\Hooks\IHook;
use FuseCommerce\Config\Config;
use FuseCommerce\Views\Admin\Settings\MainSettings;

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__('FtlCommerce Settings', 'ftlcommerce-instant-product-search'), esc_html__('FtlCommerce Settings', 'ftlcommerce-instant-product-search'), 
        'manage_options', $mainSettingsPageSlug, [$mainSettings, 'render'], NULL, 81);
    }
}