<?php
declare(strict_types=1);

namespace App\Framework\Core\System\Ini;

enum Access: string
{
    case USER = "USER";
    case PERDIR = "Per Directory";
    case SYSTEM = "System";
    case ALL = "All";

    public static function fromBitmask(int $bitmask): self
    {
        return match ($bitmask) {
            INI_USER => self::USER,
            INI_PERDIR => self::PERDIR,
            INI_SYSTEM => self::SYSTEM,
            INI_ALL => self::ALL,
            default => throw new \InvalidArgumentException("Invalid bitmask value: {$bitmask}")
        };
    }
}
