<?php

/**
 * Plugin Builder module bootstrap.
 *
 * @package LolaCore\PluginBuilder
 * @license GPL-2.0-or-later
 */

declare(strict_types=1);

namespace LolaCore\PluginBuilder;

use LolaCore\PluginBuilder\Admin\AdminAssets;
use LolaCore\PluginBuilder\Admin\LibraryColumns;
use LolaCore\PluginBuilder\Admin\PluginBuilderAjax;
use LolaCore\PluginBuilder\Admin\PluginEditScreen;
use LolaCore\PluginBuilder\Async\BuilderWorker;
use LolaCore\PluginBuilder\Async\JobController;
use LolaCore\PluginBuilder\Playground\PlaygroundBlueprintController;
use LolaCore\PluginBuilder\PostType\PluginPostType;

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

/**
 * Wires the Plugin Builder CPT and related hooks into WordPress.
 */
class PluginBuilderBootstrap {

	/**
	 * Register Plugin Builder components.
	 */
	public function register(): void {
		$post_type = new PluginPostType();
		$post_type->register();

		$library = new LibraryColumns();
		$library->register();

		$ajax = new PluginBuilderAjax();
		$ajax->register();

		$edit_screen = new PluginEditScreen();
		$edit_screen->register();

		$assets = new AdminAssets();
		$assets->register();

		// Async builder: background worker (AJAX loopback) + REST polling endpoint.
		$worker = new BuilderWorker();
		$worker->register();

		$jobController = new JobController();
		$jobController->register();

		$playgroundBlueprint = new PlaygroundBlueprintController();
		$playgroundBlueprint->register();
	}
}
