<?php

namespace modules\subusers\classes;

use modules\subusers\helpers\subusers_permission_node_key;
use modules\subusers\helpers\subusers_permission_type;
use modules\subusers\interfaces\subusers_permission_node_i;
use modules\subusers\traits\subusers_permission_node_t;

class subusers_permission_node implements subusers_permission_node_i
{
    use subusers_permission_node_t;

    /**
     * The node key of the permission node, used for internal reference and storage
     * @var subusers_permission_node_key $nodeKey
     */
    protected subusers_permission_node_key $nodeKey;
    /**
     * The name of the permission node
     * @var string $name
     */
    public string $name;
    /**
     * The description of the permission node
     * @var string $description
     */
    public string $description;
    /**
     * The type of permission this node represents
     * @var subusers_permission_type $type
     */
    public subusers_permission_type $type;
    /**
     * The value of the permission node, true if the permission is granted, false if not
     * @var bool|null $value
     */
    public ?bool $value;

    public function __construct(
        subusers_permission_node_key $nodeKey,
        string $name,
        string $description,
        subusers_permission_type $type,
        ?bool $value = null
    ) {
        $this->nodeKey = $nodeKey;
        $this->name = $name;
        $this->description = $description;
        $this->type = $type;
        $this->value = $value;
    }
}