<?php

declare(strict_types=1);

namespace PhpWA\Storage;

use InvalidArgumentException;

final class StoredValue
{
    /** @var string */ private $value;
    /** @var int */ private $revision;

    public function __construct(string $value, int $revision)
    {
        if ($revision < 1) {
            throw new InvalidArgumentException('Stored value revision must be positive.');
        }
        $this->value = $value;
        $this->revision = $revision;
    }

    public function value(): string { return $this->value; }
    public function revision(): int { return $this->revision; }
}
