<?php
/**
 * Bundled core Extension manifest.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Extension;

/** Declares the core distributable package. */
final class BundledExtensionCatalog {
	/** @return ExtensionDefinition[] */
	public function definitions(): array {
		$omitted_admin_modules = array(
			BundledModuleIds::ADMIN_RECORDING,
			BundledModuleIds::ADMIN_RUN_HISTORY,
		);
		$module_ids            = array_values(
			array_filter(
				array_map(
					static fn ( ModuleDefinition $definition ): string => $definition->slug(),
					( new BundledModuleCatalog() )->definitions()
				),
				static fn ( string $module_id ): bool => ! in_array( $module_id, $omitted_admin_modules, true )
			)
		);

		return array(
			new ExtensionDefinition(
				'scheduled-changes-core',
				'JJ\'s Post Scheduler Core Extension',
				defined( 'SCHEDULED_CHANGES_VERSION' ) ? (string) SCHEDULED_CHANGES_VERSION : '1.0.0',
				defined( 'SCHEDULED_CHANGES_PLUGIN_FILE' ) ? (string) SCHEDULED_CHANGES_PLUGIN_FILE : 'jjs-post-scheduler.php',
				$module_ids,
				'Bundles the native scheduling runtime, lifecycle, WordPress data, delivery, diagnostics, and administration modules.',
				ExtensionDefinition::VISIBILITY_PUBLIC
			),
		);
	}
}
