<?php

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

class AIEO_DMM_Web_Push_Display extends AIEO_DMM_Module_Base {

    public function get_id()       { return 'web_push_display'; }
    public function get_label()    { return __('Web Push Banner Appearance', 'ai-eshop-optimizer'); }
    public function get_priority() { return 50; }
    public function get_group()    { return 'visuals'; }

    public function register_hooks() {
        
        
    }

    
    public function enqueue_admin_assets() {
        wp_enqueue_style('wp-color-picker');
        wp_enqueue_script('wp-color-picker');
        wp_add_inline_script('wp-color-picker',
            'jQuery(function($){$(".aieo-dmm-push-color").wpColorPicker();});'
        );
    }

    public function render_subtab() {
        $parent = $this->resolve_parent();
        if ($parent && method_exists($parent, 'render_banner_appearance_card')) {
            $parent->render_banner_appearance_card();
        } else {
            echo '<div class="aieo-dmm-section"><p style="color:#b91c1c;">'
               . esc_html__('Web Push module is not loaded — check that AIEO_DMM_Web_Push is active.', 'ai-eshop-optimizer')
               . '</p></div>';
        }
    }

    private function resolve_parent() {
        if (!class_exists('AIEO_DMM')) { return null; }
        $dmm = AIEO_DMM::instance();
        if (!$dmm || !method_exists($dmm, 'get_module')) { return null; }
        
        return $dmm->get_module('web-push');
    }
}
