<?php

declare(strict_types=1);

namespace PhpWA\Storage;

use InvalidArgumentException;
use PhpWA\Auth\AuthenticationCredentials;

final class CredentialRecord
{
    /** @var AuthenticationCredentials */ private $credentials;
    /** @var int */ private $revision;

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

    public function credentials(): AuthenticationCredentials
    {
        return $this->credentials;
    }

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