<?php
if (!defined('ABSPATH')) {
    exit;
}

/**
 * Register Custom Post Types
 *
 * @package    Kitsune_AI_Platform
 * @subpackage Kitsune_AI_Platform/includes
 */

class Kitsune_AI_Platform_CPT {

    /**
     * Initialize the class and set its properties.
     */
    public function __construct() {
        add_action('init', array($this, 'register_post_types'));
    }

    /**
     * Register Custom Post Types
     */
    public function register_post_types() {
        // Chatbots CPT
        register_post_type('kitsune_ai_chatbot', array(
            'labels' => array(
                'name' => __('Chatbots', 'kitsune-ai-platform'),
                'singular_name' => __('Chatbot', 'kitsune-ai-platform'),
            ),
            'public' => false,
            'show_ui' => false, // Hidden from Admin Menu
            'supports' => array('title', 'editor', 'author', 'custom-fields'),
            'capability_type' => 'post',
            'rewrite' => false,
        ));

        // Chatbot Templates CPT
        register_post_type('kitsune_ai_chat_tpl', array(
            'labels' => array(
                'name' => __('Chatbot Templates', 'kitsune-ai-platform'),
                'singular_name' => __('Chatbot Template', 'kitsune-ai-platform'),
            ),
            'public' => false,
            'show_ui' => false, // Hidden from Admin Menu
            'supports' => array('title', 'editor', 'author', 'custom-fields'),
            'capability_type' => 'post',
            'rewrite' => false,
        ));

        // Automation Workflows CPT
        register_post_type('kitsune_ai_workflow', array(
            'labels' => array(
                'name' => __('Automation Workflows', 'kitsune-ai-platform'),
                'singular_name' => __('Workflow', 'kitsune-ai-platform'),
            ),
            'public' => false,
            'show_ui' => false,
            'supports' => array('title', 'author', 'custom-fields'),
            'capability_type' => 'post',
            'rewrite' => false,
        ));

        // Scheduled Tasks CPT
        register_post_type('kitsune_ai_sched_task', array(
            'labels' => array(
                'name' => __('Scheduled Tasks', 'kitsune-ai-platform'),
                'singular_name' => __('Scheduled Task', 'kitsune-ai-platform'),
            ),
            'public' => false,
            'show_ui' => false, // Hidden from Admin Menu - managed via Vue SPA
            'supports' => array('title', 'author', 'custom-fields'),
            'capability_type' => 'post',
            'rewrite' => false,
        ));

        // AI Content CPT - Stores AI-generated content
        register_post_type('kitsune_ai_content', array(
            'labels' => array(
                'name' => __('AI Content', 'kitsune-ai-platform'),
                'singular_name' => __('AI Content', 'kitsune-ai-platform'),
            ),
            'public' => false,
            'show_ui' => false, // Hidden from Admin Menu - managed via Vue SPA
            'supports' => array('title', 'editor', 'author', 'custom-fields'),
            'capability_type' => 'post',
            'rewrite' => false,
        ));

        // AI Forms CPT - Stores AI-powered forms configuration
        register_post_type('kitsune_ai_form', array(
            'labels' => array(
                'name' => __('AI Forms', 'kitsune-ai-platform'),
                'singular_name' => __('AI Form', 'kitsune-ai-platform'),
            ),
            'public' => false,
            'show_ui' => false, // Hidden from Admin Menu - managed via Vue SPA
            'supports' => array('title', 'editor', 'author', 'custom-fields'),
            'capability_type' => 'post',
            'rewrite' => false,
        ));

        // Knowledge Base Sources CPT - Stores KB source configurations
        register_post_type('kitsune_ai_kb_source', array(
            'labels' => array(
                'name' => __('KB Sources', 'kitsune-ai-platform'),
                'singular_name' => __('KB Source', 'kitsune-ai-platform'),
            ),
            'public' => false,
            'show_ui' => false, // Hidden from Admin Menu - managed via Vue SPA
            'supports' => array('title', 'editor', 'author', 'custom-fields'),
            'capability_type' => 'post',
            'rewrite' => false,
        ));

        // API Keys CPT - Stores generated API access keys
        register_post_type('kitsune_ai_api_key', array(
            'labels' => array(
                'name' => __('API Keys', 'kitsune-ai-platform'),
                'singular_name' => __('API Key', 'kitsune-ai-platform'),
            ),
            'public' => false,
            'show_ui' => false, // Hidden from Admin Menu - managed via Vue SPA
            'supports' => array('title', 'author', 'custom-fields'),
            'capability_type' => 'post',
            'rewrite' => false,
        ));
    }
}
