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

namespace Awesomemotive\Rewardswp\Database\Upgrades;

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

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

/**
 * Class CreatePointsTableUpgrade.
 */
class CreatePointsTableUpgrade extends AbstractDatabaseUpgrade {
	/**
	 * Upgrade target version.
	 *
	 * @var string
	 */
	protected string $version = '1.1.0';

	/**
	 * Points table instance.
	 *
	 * @since 1.0.1
	 *
	 * @var PointsTable
	 */
	private PointsTable $table;

	/**
	 * Constructor.
	 *
	 * @since 1.0.1
	 *
	 * @param PointsTable $table Points table instance.
	 */
	public function __construct( PointsTable $table ) {
		$this->table = $table;
	}

	/**
	 * Run the upgrade.
	 *
	 * This will include the 'token' column to the Members table.
	 *
	 * @return void
	 */
	public function up(): void {
		$this->table->create_or_update_table();
	}
}
