<?php
/**
 * Migration Service Provider Class
 *
 * @since 3.0.0
 * @package DokanKits\Core\DI\Providers
 */

namespace DokanKits\Core\DI\Providers;

use DokanKits\Core\DI\BaseServiceProvider;
use DokanKits\Setup\Migrations\V300;
use DokanKits\Setup\Migrator;

/**
 * Class Migration_Service_Provider
 *
 * Registers migration services with the container.
 *
 * @since 3.0.0
 */
class MigrationServiceProvider extends BaseServiceProvider {

	/**
	 * Services provided by this provider
	 *
	 * @var array
	 */
	protected array $services = array(
		Migrator::class,

		// Migration classes.
		V300\CreateDefaultSettings::class,
		V300\MigrateOldSettings::class,
	);

	/**
	 * Tags for this provider
	 *
	 * @var array
	 */
	protected array $tags = array( 'migration-service' );

	/**
	 * Register hooks for the provider services.
	 *
	 * @since 3.0.0
	 * @return void
	 */
	public function register(): void {
		// Register services with tags.
		foreach ( $this->services as $service ) {
			$definition = $this->share_with_implements_tags( $service );
			$this->add_tags( $definition, $this->tags );
		}
	}
}
