<?php
/**
 * AdminCptHook class.
 *
 * Registers the custom post type used to store Firevert settings.
 *
 * @package Ilabs\Firevert\Core\Hooks\Admin
 */

declare( strict_types=1 );

namespace Ilabs\Firevert\Core\Hooks\Admin;

/**
 * Class AdminCptHook
 *
 * Handles CPT registration for Firevert settings.
 */
class AdminCptHook {

	/**
	 * Registers the WordPress hook for CPT registration.
	 */
	public function register(): void {
		if ( did_action( 'init' ) ) {
			$this->register_cpt();

			return;
		}

		add_action( 'init', array( $this, 'register_cpt' ), 0 );
	}

	/**
	 * Registers the custom post type 'firevert_setting'.
	 */
	public function register_cpt(): void {
		register_post_type(
			'firevert_setting',
			array(
				'label'           => 'Firevert Settings',
				'public'          => false,
				'show_ui'         => false,
				'show_in_rest'    => false,
				'supports'        => array( 'custom-fields' ),
				'capability_type' => 'post',
			)
		);
	}
}
