<?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.0' );

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

	return $theme;
}
