<?php
/**
 * Load theme tokens and dependencies
 *
 * @package Teydea_Studio\Careers
 */

namespace Teydea_Studio\Careers;

use Teydea_Studio\Careers\Dependencies\Utils;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // @codeCoverageIgnore
}

/**
 * Class autoloader
 */
spl_autoload_register(
	/**
	 * Autoload theme classes
	 *
	 * @param string $class_name Class name.
	 *
	 * @return void
	 */
	function ( string $class_name ): void {
		$class_map = include __DIR__ . '/classmap.php';

		if ( isset( $class_map[ $class_name ] ) ) {
			require_once __DIR__ . $class_map[ $class_name ];
		}
	},
);

/**
 * Get the theme container object
 *
 * @return Utils\Theme Theme container object.
 */
function get_container(): Utils\Theme {
	static $theme = null;

	if ( null === $theme ) {
		// Construct the theme object.
		$theme = new Utils\Theme();

		$theme->set_data_prefix( 'careers' );
		$theme->set_main_dir( __DIR__ );
		$theme->set_name( 'Careers' );
		$theme->set_slug( 'careers' );
		$theme->set_text_domain( 'careers' );
		$theme->set_version( '1.4.1' );

		$theme->register_modules(
			[
				Modules\Admin_Notice\Module_Admin_Notice::class,
				Modules\Hiring_Center_Integration\Module_Hiring_Center_Integration::class,
				Modules\Settings_Page\Module_Settings_Page::class,
				Modules\Setup\Module_Setup::class,
			],
		);
	}

	return $theme;
}
