<?php
/**
 * Admin module.
 *
 * @package northmill-online-shared
 */

declare(strict_types=1);

namespace Northmill_Online_Shared\Modules;

use Northmill_Online_Shared\Modules\Admin\Notices\Notice_Module;
use Northmill_Online_Shared\Modules\Admin\Pages\Admin_Pages_Module;
use Northmill_Online_Shared\Modules\Admin\Settings\Settings_Fields_Module;
use Northmill_Online_Shared\Modules\Admin\Settings\Settings_Module;
use Northmill_Online_Shared\Abstract_Shared_Base;

defined( 'ABSPATH' ) || exit;

/**
 * Class Admin_Module
 */
class Admin_Module extends Abstract_Module {

	/**
	 * Admin_Pages_Module instance.
	 *
	 * @var Admin_Pages_Module
	 */
	public Admin_Pages_Module $pages;

	/**
	 * Notice_Module instance.
	 *
	 * @var Notice_Module $notices
	 */
	public Notice_Module $notices;

	/**
	 * Settings_Fields_Module instance.
	 *
	 * @var Settings_Fields_Module
	 */
	public Settings_Fields_Module $settings_fields;

	/**
	 * Settings_Module instance.
	 *
	 * @var Settings_Module
	 */
	public Settings_Module $settings;

	/**
	 * Admin_Module constructor.
	 *
	 * @param Abstract_Shared_Base $shared Shared instance.
	 */
	public function __construct( Abstract_Shared_Base $shared ) {
		parent::__construct( $shared );

		$this->notices         = new Notice_Module( $shared );
		$this->settings_fields = new Settings_Fields_Module( $shared );
		$this->pages           = new Admin_Pages_Module( $shared );
		$this->settings        = new Settings_Module( $shared );
	}

	/**
	 * Set up the module.
	 */
	public function setup(): void {
		$this->settings_fields->setup(); // Must be before pages.
		$this->pages->setup();
		$this->notices->setup();
	}
}
