<?php
namespace AIAutoTool\Features\PromptCPT;

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

/**
 * AI Auto Tool - Prompt CPT Feature
 * 
 * @package AIAutoTool\Features\PromptCPT
 * @namespace AIAutoTool\Features\PromptCPT
 */

// Include the full Prompt CPT implementation with all features
require_once dirname(__FILE__) . '/aiautotool-prompt-cpt.php';

// Create namespace wrapper
if (!class_exists('AIAutoTool\\Features\\PromptCPT\\PromptCPT')) {
    class PromptCPT extends \AIautotool_Prompt_CPT {
        public $active_option_name = 'AIautotool_Prompt_CPT_active'; // Match with integrations page
        public $icon = '<i class="fa-solid fa-file-text"></i>';
        
        public function __construct() {
            // Ensure correct option name (match with integrations page)
            $this->active_option_name = 'AIautotool_Prompt_CPT_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('prompt_cpt');
            if (!$description) {
                $description = __('Custom Post Type for managing AI prompts', 'ai-auto-tool');
            }
            
            $autoToolBox = new \AutoToolBox(
                esc_html__('Prompt CPT', 'ai-auto-tool'),
                $description,
                "https://doc.aiautotool.com/features/prompt-cpt",
                $this->active_option_name,
                $this->active,
                plugins_url('../../images/logo.svg', __FILE__)
            );
            
            echo $autoToolBox->generateHTML();
        }
        
        /**
         * Render tab setting - Parent class has empty implementation, so we implement it here
         */
        public function render_tab_setting() {
            if ($this->active == 'true') {
                // Prompt CPT typically uses its own admin page, not tabs
                // But we can add tab if needed in the future
            }
        }
        
        /**
         * Render settings page - Parent class has empty implementation
         * Prompt CPT uses its own admin page via CPT
         */
    }
}
