<?php
namespace AIAutoTool\Features\LegalPagesGenerator;

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

/**
 * AI Auto Tool - Legal Pages Generator Feature
 * 
 * @package AIAutoTool\Features\LegalPagesGenerator
 * @namespace AIAutoTool\Features\LegalPagesGenerator
 */

// Include the main implementation
require_once dirname(__FILE__) . '/aiautotool_legal_pages_generator.php';

// Create namespace wrapper
if (!class_exists('AIAutoTool\\Features\\LegalPagesGenerator\\LegalPagesGenerator')) {
    class LegalPagesGenerator extends \AIautotool_Legal_Pages_Generator {
        public $active_option_name = 'AIautotool_legal_pages_active';
        public $icon = '<i class="fa-solid fa-file-contract"></i>';
        
        public function __construct() {
            // Ensure correct option name
            $this->active_option_name = 'AIautotool_legal_pages_active';
            parent::__construct();
        }
        
        /**
         * Render feature for integrations page
         */
        public function render_feature() {
            // Load feature descriptions - correct path from feature directory
            $lib_path = plugin_dir_path(dirname(dirname(dirname(__FILE__)))) . 'lib/feature-descriptions.php';
            if (!class_exists('\\AiAutoTool_Feature_Descriptions') && file_exists($lib_path)) {
                require_once $lib_path;
            }
            
            $description = __('Automatically generate essential legal pages (About Us, Terms of Service, Privacy Policy, Disclaimer, Contact Us) using AI. All pages are created in English as drafts for your review before publishing.', 'ai-auto-tool');
            
            if (class_exists('\\AiAutoTool_Feature_Descriptions')) {
                $desc = \AiAutoTool_Feature_Descriptions::get('legal_pages_generator');
                if ($desc) {
                    $description = $desc;
                }
            }
            
            $autoToolBox = new \AutoToolBox(
                esc_html__('Legal Pages Generator', 'ai-auto-tool'),
                $description,
                "https://doc.aiautotool.com/features/legal-pages-generator",
                $this->active_option_name,
                $this->active,
                plugins_url('../../images/logo.svg', __FILE__)
            );
            
            echo $autoToolBox->generateHTML();
        }
        
        /**
         * Render tab setting - inherited from parent
         */
        public function render_tab_setting() {
            parent::render_tab_setting();
        }
        
        /**
         * Render settings page - inherited from parent
         */
        public function render_setting() {
            parent::render_setting();
        }
    }
}
