<?php
namespace IcreatorCookieConsent;

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

class Utils {
    public static function boot(): void {
        add_filter('plugin_action_links_' . ICCB_PLUGIN_BASENAME, [self::class, 'settings_link']);
        add_action('admin_head', [self::class,'help_tabs']);
    }

    public static function settings_link($links) {
        $settings_link = '<a href="admin.php?page=iccb_dashboard">' . esc_html__('Settings', 'consentpress') . '</a>';
        array_unshift($links, $settings_link);
        return $links;
    }
    
    public static function help_tabs() {
        $screen = get_current_screen();
        if ($screen->id !== 'toplevel_page_iccb_dashboard') return;
    
        // Overview Tab
        $screen->add_help_tab([
            'id'      => 'overview',
            'title'   => __('Overview', 'consentpress'),
            'content' => '<p>' . __('ConsentPress Free adds an essential cookie banner and cookie table for your WordPress site.', 'consentpress') . '</p>',
        ]);
    
        // Cookie Banner Tab
        $screen->add_help_tab([
            'id'      => 'banner',
            'title'   => __('Cookie Banner', 'consentpress'),
            'content' => '<p>' . __('You can customize the banner message, labels, accent color, and default consent categories under Cookie Settings.', 'consentpress') . '</p>',
        ]);
    
        // Cookie Definitions Tab
        $screen->add_help_tab([
            'id'      => 'definitions',
            'title'   => __('Cookie Definitions', 'consentpress'),
            'content' => '<p>' . __('Use the Cookie Definitions tab to define the cookies found on your site, categorize them, and assign durations and providers. These are shown in your frontend cookie list.', 'consentpress') . '</p>',
        ]);
    
        $screen->add_help_tab([
            'id'      => 'pro',
            'title'   => __('Pro Features', 'consentpress'),
            'content' => '<p>' . __('Upgrade to ConsentPress Pro for per-domain tracking IDs, script blocking, consent logs, CSV exports, diagnostics, and extended scanning tools.', 'consentpress') . '</p>',
        ]);
    
        // Sidebar
        $screen->set_help_sidebar(
            '<p><strong>' . __('Need more help?', 'consentpress') . '</strong></p>' .
            '<p><a href="https://consentpress.com/docs" target="_blank">' . __('Plugin Documentation', 'consentpress') . '</a></p>' .
            '<p><a href="mailto:support@consentpress.com">' . __('Contact Support', 'consentpress') . '</a></p>'
        );
    }
}
