<?php

namespace SugarCalendarBookings\Migration\Commands;

use SugarCalendarBookings\Support\Bootable;
use WP_CLI;

/**
 * Command Registry.
 *
 * Registers WP CLI commands for the migration feature.
 *
 * @since 1.3.0
 */
class CommandRegistry implements Bootable {

	/**
	 * Check if WP CLI commands should be loaded.
	 *
	 * @since 1.3.0
	 *
	 * @return bool
	 */
	public function allow_load(): bool {

		return defined( 'WP_CLI' ) && WP_CLI;
	}

	/**
	 * Initialize the command registry.
	 *
	 * @since 1.3.0
	 */
	public function init() {

		$this->register_commands();
	}

	/**
	 * Register WP CLI commands.
	 *
	 * @since 1.3.0
	 */
	private function register_commands() {

		WP_CLI::add_command( 'scbookings migrate', MigrateCommand::class );
	}
}
