<?php

namespace Tests\Unit\Enums;

use App\Enums\ApprovalStatusEnum;
use PHPUnit\Framework\TestCase;

class ApprovalStatusEnumTest extends TestCase
{
    public function test_pending_is_not_a_decision(): void
    {
        $this->assertFalse(ApprovalStatusEnum::PENDING->isDecided());
    }

    public function test_approved_and_rejected_are_decisions(): void
    {
        $this->assertTrue(ApprovalStatusEnum::APPROVED->isDecided());
        $this->assertTrue(ApprovalStatusEnum::REJECTED->isDecided());
    }

    public function test_decided_values_lists_every_decided_case(): void
    {
        $this->assertSame(['approved', 'rejected'], ApprovalStatusEnum::decidedValues());
    }

    public function test_decided_values_stays_in_step_with_the_cases(): void
    {
        $expected = array_values(array_map(
            fn (ApprovalStatusEnum $status): string => $status->value,
            array_filter(
                ApprovalStatusEnum::cases(),
                fn (ApprovalStatusEnum $status): bool => $status->isDecided(),
            ),
        ));

        $this->assertSame($expected, ApprovalStatusEnum::decidedValues());
    }
}
