<?php
/**
 * @license GPL-2.0-or-later
 *
 * Modified using Strauss.
 * @see https://github.com/BrianHenryIE/strauss
 */ declare(strict_types=1);

namespace RCP\LiquidWeb\LicensingApiClient\Value;

use InvalidArgumentException;

/**
 * Represents a normalized non-empty authentication token value.
 */
final class AuthToken
{
	private string $token;

	/**
	 * @throws InvalidArgumentException
	 */
	public function __construct(string $token) {
		$token = trim($token);

		if ($token === '') {
			throw new InvalidArgumentException('Authentication token cannot be empty.');
		}

		$this->token = $token;
	}

	public function equals(self $authToken): bool {
		return $this->token === $authToken->get();
	}

	public function get(): string {
		return $this->token;
	}
}
