<?php
namespace AIAutoTool\Features\SuggestAuto;

if ( ! defined( 'ABSPATH' ) ) exit; // Thoát nếu truy cập trực tiếp

/**
 * AI Auto Tool - Suggest Auto Feature
 * 
 * @package AIAutoTool\Features\SuggestAuto
 * @namespace AIAutoTool\Features\SuggestAuto
 */

// Include the full Suggest Auto implementation with all features
require_once dirname(__FILE__) . '/AI_AutoTool_suggetauto.php';

// Create namespace wrapper
if (!class_exists('AIAutoTool\\Features\\SuggestAuto\\SuggestAuto')) {
    class SuggestAuto extends \AI_AutoTool_suggetauto {
        public $active_option_name = 'AI_AutoTool_suggetauto_active';
        public $icon = '<i class="fa-solid fa-lightbulb"></i>';
        
        public function __construct() {
            // Ensure correct option name
            $this->active_option_name = 'AI_AutoTool_suggetauto_active';
            parent::__construct();
        }
        
        /**
         * Render feature for integrations page
         */
        public function render_feature() {
            // Load feature descriptions
            require_once plugin_dir_path(dirname(__FILE__)) . 'lib/feature-descriptions.php';
            
            $description = \AiAutoTool_Feature_Descriptions::get('suggest_auto');
            if (!$description) {
                $description = __('Automatic content suggestions and draft generation', 'ai-auto-tool');
            }
            
            $autoToolBox = new \AutoToolBox(
                esc_html__('Suggest Auto', 'ai-auto-tool'),
                $description,
                "https://doc.aiautotool.com/features/suggest-auto",
                $this->active_option_name,
                $this->active,
                plugins_url('../../images/logo.svg', __FILE__)
            );
            
            echo $autoToolBox->generateHTML();
        }
        
        /**
         * Render tab setting - Already inherited from parent class AI_AutoTool_suggetauto
         * But we override to ensure it works correctly
         */
        public function render_tab_setting() {
            if ($this->active == 'true') {
                echo '<button href="#tool-suggest" class="nav-tab sotab"><i class="fa-solid fa-lightbulb"></i> ' . esc_html__('AI Suggest New Post', 'ai-auto-tool') . '</button>';
            }
        }
        
        /**
         * Render settings page - Already inherited from parent class AI_AutoTool_suggetauto
         * This method is already implemented in parent class, no need to override
         */
    }
}
