<?php

namespace WeDevs\AppBridge\Integrations\WPProjectManager;

use WeDevs\AppBridge\Core\AbstractIntegration;
use WeDevs\AppBridge\Core\Contracts\Hookable;
use WeDevs\AppBridge\Integrations\WPProjectManager\REST\LicenseController;
use WeDevs\AppBridge\Integrations\WPProjectManager\REST\SettingsController;

class WPProjectManagerIntegration extends AbstractIntegration {

	private LicenseManager $license_manager;

	public function __construct() {
		$this->license_manager = new LicenseManager();
	}

	public function get_license_manager(): LicenseManager {
		return $this->license_manager;
	}

	public static function is_active(): bool {
		return class_exists( 'WeDevs\PM\Core\WP\WP_Project_Manager' ) || defined( 'PM_VERSION' );
	}

	public function hookables(): array {
		return [
			$this->license_manager,
		];
	}

	public function rest_controllers(): array {
		return [
			new SettingsController(),
			new LicenseController( $this->license_manager ),
		];
	}

	public function menus(): array {
		return [
			[
				'label'    => __( 'WP Project Manager', 'app-bridge' ),
				'slug'     => 'app-bridge-wp-project-manager',
				'mount_id' => 'app-bridge-wp-project-manager',
			],
		];
	}
}
