<?php

namespace Wpxero\Marqueex\Admin;

use Wpxero\Marqueex\Traits\Singleton;

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

class Menu {
    use Singleton;

    private function __construct() {
        add_action('admin_menu', [$this, 'register_menu']);
    }

    public function register_menu() {
        // Add main menu
        add_menu_page(
            __('MarqueeX', 'marqueex'),
            __('MarqueeX', 'marqueex'),
            'manage_options',
            'marqueex',
            [$this, 'render_menu_page'],
            'data:image/svg+xml;base64,' . base64_encode('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" id="Maya-Logo--Streamline-Logos" height="24" width="24"><path fill="#fff" fill-rule="evenodd" d="M1 1.948 7 1.5l4.994 10.987L13.988 18H10.5l-4.727 -6.913 -4.772 -9.139Zm0 3.24v14.71c1.574 -2.424 2.857 -4.752 3.76 -7.511L1 5.187ZM1.064 22.5c2.955 -0.003 4.125 -0.214 4.65 -1v-7.325c-1.169 3.028 -2.779 5.59 -4.65 8.325Zm13.905 -6.197 2.77 -4.847L22.967 2H16.5l-3.636 8.483 2.105 5.82ZM23 5.04l-5 9.046v5.468a35.72 35.72 0 0 0 2.834 -5.037C21.96 12.081 22.768 9.61 23 7.584V5.039Zm0 8.227a35.322 35.322 0 0 1 -0.804 1.879c-1.174 2.542 -2.66 5.01 -4.15 6.878L19 22.5h4v-9.234Z" clip-rule="evenodd" stroke-width="1"></path></svg>'),
            30
        );
        add_submenu_page(
            'marqueex',
            '',
            esc_html__('Settings', 'marqueex'),
            'manage_options',
            'marqueex-settings',
            [$this, 'render_menu_page']
        );
    }

    public function render_menu_page() {
        echo '<div class="wrap">';
        echo '<div id="marqueex-admin-page"></div>';
        echo '</div>';
    }
}
