<?php
/**
 * Blog Over Pro Information Notices
 *
 * Registers subtle informational notices in relevant Customizer sections.
 * These inform users about additional options available in Blog Over Pro.
 * Only registered when the Pro plugin is NOT active.
 *
 * Follows WordPress.org theme guidelines — no disabled controls,
 * no aggressive upsell, no trialware behavior.
 *
 * @package Blog_Over
 * @since 2.1.0
 */

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

/**
 * Register informational Pro notices in Customizer sections.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function blog_over_register_pro_info_notices($wp_customize)
{

    // Skip if Pro plugin is active — no notices needed.
    if (blog_over_is_pro_active()) {
        return;
    }

    // Load the Info Control class.
    require_once BLOG_OVER_DIR . '/inc/controls/class-blog-over-pro-feature-control.php';

    $pro_url = 'https://awplife.com/wordpress-themes/blog-over/';
    $info_text = __('Some advanced styling options are available in Blog Over Pro.', 'blog-over');
    $link_text = __('Learn more about Pro →', 'blog-over');

    // Sections that get a Pro info notice (setting_id => section_id).
    $sections = array(
        'blog_over_pro_info_search' => 'blog_over_search_section',
        'blog_over_pro_info_menu' => 'blog_over_menu_section',
        'blog_over_pro_info_ticker' => 'blog_over_ticker_section',
        'blog_over_pro_info_hero' => 'blog_over_hero_section',
        'blog_over_pro_info_featured' => 'blog_over_featured_section',
        'blog_over_pro_info_missed' => 'blog_over_missed_section',
        'blog_over_pro_info_author' => 'blog_over_author_box_section',
        'blog_over_pro_info_postnav' => 'blog_over_postnav_section',
        'blog_over_pro_info_related' => 'blog_over_related_section',
        'blog_over_pro_info_sidebar' => 'blog_over_sidebar_section',
        'blog_over_pro_info_loader' => 'blog_over_loading_screen_section',
    );

    foreach ($sections as $setting_id => $section_id) {
        $wp_customize->add_setting($setting_id, array(
            'sanitize_callback' => 'sanitize_text_field',
        ));

        $wp_customize->add_control(new Blog_Over_Info_Control($wp_customize, $setting_id, array(
            'label' => $info_text,
            'section' => $section_id,
            'priority' => 999,
            'info_url' => $pro_url,
            'info_link_text' => $link_text,
        )));
    }
}
add_action('customize_register', 'blog_over_register_pro_info_notices', 99);
