<?php
/**
 * CreateNotificationsTableUpgrade.php.
 *
 * @package RewardsWP
 */

namespace Awesomemotive\Rewardswp\Database\Upgrades;

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

use Awesomemotive\Rewardswp\Abstracts\AbstractDatabaseUpgrade;
use Awesomemotive\Rewardswp\Database\Tables\NotificationsTable;

/**
 * Create the Notifications table upgrade.
 *
 * @since 1.1.0
 */
/**
 * Class CreateNotificationsTableUpgrade.
 */
class CreateNotificationsTableUpgrade extends AbstractDatabaseUpgrade {
	/**
	 * Database version for this upgrade.
	 *
	 * @since 1.1.0
	 * @var string
	 */
	protected string $version = '1.1.0';

	/**
	 * Notifications table instance.
	 *
	 * @since 1.1.0
	 * @var NotificationsTable
	 */
	private NotificationsTable $table;

	/**
	 * Constructor.
	 *
	 * @since 1.1.0
	 * @param NotificationsTable $table Notifications table instance.
	 */
	public function __construct( NotificationsTable $table ) {
		$this->table = $table;
	}

	/**
	 * Run the upgrade.
	 *
	 * This will create the notifications table.
	 *
	 * @since 1.1.0
	 * @return void
	 */
	public function up(): void {
		$this->table->create_or_update_table();
	}
}
