<?php
namespace Misuzu\Users;

use Index\DateTime;

abstract class UserInfo {
    abstract public function getId(): string;
    abstract public function getName(): string;
    abstract public function getCountryCode(): string;

    abstract public function isGuest(): bool;
    abstract public function isSystem(): bool;
    abstract public function isSuper(): bool;

    abstract public function getDisplayRoleId(): string;

    // need Index colour type
    //abstract public function getColour(): ?int;

    abstract public function getCreatedDate(): DateTime;
    abstract public function getLastActiveDate(): DateTime;
    abstract public function getDeletedDate(): DateTime;

    public function hasColour(): bool {
        return $this->getColour() !== null;
    }

    private static DateTime $epoch;
    public function isDeleted(): bool {
        return self::$epoch->diff($this->getDeletedDate())->totalSeconds() > 0;
    }

    public static function init(): void {
        self::$epoch = DateTime::fromUnixTimeSeconds(0);
    }
}

UserInfo::init();
