<?php
/**
 * Admin module bootstrap.
 *
 * @since 1.0.0
 */

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

class ZINV_Admin {

    private static ?self $instance = null;

    private function __clone() {}

    public function __wakeup(): void {
        throw new \Exception( 'Cannot unserialize singleton.' );
    }

    public static function get_instance(): self {
        if ( null === self::$instance ) {
            self::$instance = new self();
        }
        return self::$instance;
    }

    public function init(): void {
        $this->init_menu();
        $this->init_page();
        $this->init_assets();
    }

    private function init_menu(): void {
        if ( class_exists( 'ZINV_Menu' ) ) {
            ZINV_Menu::register();
        }
    }

    private function init_page(): void {
        if ( class_exists( 'ZINV_Admin_Page' ) ) {
            ZINV_Admin_Page::register();
        }
    }

    private function init_assets(): void {
        if ( class_exists( 'ZINV_Assets' ) ) {
            ZINV_Assets::register();
        }
    }
}
