<?php

declare(strict_types=1);

namespace App\Scolarite\Application\Port;

/**
 * Avertissement d'une règle de devoir non respectée.
 */
final readonly class RuleWarning
{
    /**
     * @param array<string, mixed> $params Paramètres de la règle pour le frontend
     */
    public function __construct(
        public string $ruleType,
        public string $message,
        public array $params = [],
    ) {
    }

    /**
     * @return array{ruleType: string, message: string, params: array<string, mixed>}
     */
    public function toArray(): array
    {
        return [
            'ruleType' => $this->ruleType,
            'message' => $this->message,
            'params' => $this->params,
        ];
    }
}
