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

namespace KadenceWP\KadencePro\LiquidWeb\LicensingApiClient\Responses\Entitlement;

use KadenceWP\KadencePro\LiquidWeb\LicensingApiClient\Responses\Contracts\Response;

/**
 * Represents a suspended entitlement response payload.
 *
 * @implements Response<array{
 *     product_slug: string,
 *     tier: string,
 *     status: string
 * }>
 */
final class Suspend implements Response
{
	public string $productSlug;

	public string $tier;

	public string $status;

	private function __construct(string $productSlug, string $tier, string $status) {
		$this->productSlug = $productSlug;
		$this->tier        = $tier;
		$this->status      = $status;
	}

	/**
	 * @param array{
	 *     product_slug: string,
	 *     tier: string,
	 *     status: string
	 * } $attributes
	 */
	public static function from(array $attributes): self {
		return new self(
			$attributes['product_slug'],
			$attributes['tier'],
			$attributes['status']
		);
	}

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