<?php

declare(strict_types=1);

namespace PhpWA\AppState;

use InvalidArgumentException;

final class AppStateSyncResult
{
      private $name;
      private $version;
      private $mutations;
      private $hasMore;
      private $includedSnapshot;

    public function __construct(string $name, int $version, int $mutations, bool $hasMore, bool $includedSnapshot)
    {
        AppStateName::assert($name);
        if ($version < 0 || $mutations < 0) { throw new InvalidArgumentException('App-state sync result is invalid.'); }
        $this->name = $name; $this->version = $version; $this->mutations = $mutations;
        $this->hasMore = $hasMore; $this->includedSnapshot = $includedSnapshot;
    }

    public function name(): string { return $this->name; }
    public function version(): int { return $this->version; }
    public function mutations(): int { return $this->mutations; }
    public function hasMore(): bool { return $this->hasMore; }
    public function includedSnapshot(): bool { return $this->includedSnapshot; }
}
