<?php
/**
 * Main Lantern Span People Directory plugin coordinator.
 *
 * @package LanternSpanPeopleDirectory
 */

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

/**
 * Coordinates the plugin's components.
 */
final class LSPD_Plugin {

	/**
	 * Singleton instance.
	 *
	 * @var LSPD_Plugin|null
	 */
	private static $instance = null;

	/**
	 * Directory renderer.
	 *
	 * @var LSPD_Directory
	 */
	private $directory;

	/**
	 * Returns the singleton instance.
	 *
	 * @return LSPD_Plugin
	 */
	public static function instance() {
		if ( null === self::$instance ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	/**
	 * Sets up plugin components.
	 */
	private function __construct() {
		new LSPD_Post_Type();

		new LSPD_Admin();
		new LSPD_Settings();

		$this->directory = new LSPD_Directory();

		new LSPD_Block( $this->directory );
	}

	/**
	 * Returns the directory renderer.
	 *
	 * @return LSPD_Directory
	 */
	public function get_directory() {
		return $this->directory;
	}
}
