<?php

declare(strict_types=1);

namespace App\Framework\Validation\Rules;

use App\Framework\Validation\ValidationRule;
use Attribute;

#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)]
final class IsTrue implements ValidationRule
{
    public function validate(mixed $value): bool
    {
        if (is_bool($value)) {
            return $value;
        }

        return false;
    }

    public function getErrorMessages(): array
    {
        return ['Dieser Wert muss "true" sein.'];
    }
}
