<?php
namespace Misuzu\Counters;

use Index\DateTime;
use Index\Data\IDbResult;

class CounterInfo {
    private string $name;
    private int $value;
    private int $updated;

    public function __construct(IDbResult $result) {
        $this->name = $result->getString(0);
        $this->value = $result->getInteger(1);
        $this->updated = $result->getInteger(2);
    }

    public function getName(): string {
        return $this->name;
    }

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

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

    public function getUpdatedAt(): DateTime {
        return DateTime::fromUnixTimeSeconds($this->updated);
    }
}
