<?php
namespace Incoviba\Model;

use Incoviba\Common\Ideal;
use function password_verify;

class User extends Ideal\Model
{
    public string $name;
    public string $password;
    public bool $enabled;

    public function validate(string $provided_password): bool
    {
        return password_verify($provided_password, $this->password);
    }
    public function isAdmin(): bool
    {
        return false;
    }

    public function jsonSerialize(): mixed
    {
        return array_merge(parent::jsonSerialize(), [
            'name' => $this->name
        ]);
    }
}
