<?php
namespace Misuzu\Emoticons;

use Stringable;
use Index\Data\IDbResult;

class EmoteInfo implements Stringable {
    public function __construct(
        private string $id,
        private int $order,
        private int $rank,
        private string $url,
    ) {}

    public static function fromResult(IDbResult $result): EmoteInfo {
        return new EmoteInfo(
            id: $result->getString(0),
            order: $result->getInteger(1),
            rank: $result->getInteger(2),
            url: $result->getString(3),
        );
    }

    public function getId(): string {
        return $this->id;
    }

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

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

    public function getUrl(): string {
        return $this->url;
    }

    public function __toString(): string {
        return $this->url;
    }
}
