<?php

declare(strict_types=1);

namespace App\Tests\Unit\Auth;

use App\Domain\Auth\Role;
use PHPUnit\Framework\TestCase;

final class RoleTest extends TestCase
{
    public function testAdminSatisfiesEverything(): void
    {
        self::assertTrue(Role::Admin->satisfies(Role::Viewer));
        self::assertTrue(Role::Admin->satisfies(Role::Operator));
        self::assertTrue(Role::Admin->satisfies(Role::Admin));
    }

    public function testOperatorSatisfiesViewerButNotAdmin(): void
    {
        self::assertTrue(Role::Operator->satisfies(Role::Viewer));
        self::assertTrue(Role::Operator->satisfies(Role::Operator));
        self::assertFalse(Role::Operator->satisfies(Role::Admin));
    }

    public function testViewerOnlySatisfiesViewer(): void
    {
        self::assertTrue(Role::Viewer->satisfies(Role::Viewer));
        self::assertFalse(Role::Viewer->satisfies(Role::Operator));
        self::assertFalse(Role::Viewer->satisfies(Role::Admin));
    }
}
