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

namespace RCP\LiquidWeb\LicensingApiClient\Responses\Token;

use RCP\LiquidWeb\LicensingApiClient\Responses\Contracts\Response;

/**
 * Represents a token authorization check response.
 *
 * @implements Response<array{authorized: bool}>
 */
final class Auth implements Response
{
	public bool $authorized;

	private function __construct(bool $authorized) {
		$this->authorized = $authorized;
	}

	/**
	 * @param array{authorized: bool} $attributes
	 */
	public static function from(array $attributes): self {
		return new self($attributes['authorized']);
	}

	public function toArray(): array {
		return [
			'authorized' => $this->authorized,
		];
	}
}
