<?php

declare(strict_types=1);

namespace BookiFlex\Extensions\NotificationPreview\Api\Request;

use BookiFlex\Extensions\Notification\Model\NotificationEvent;
use BookiFlex\Extensions\Notification\Model\Recipient;

defined( 'ABSPATH' ) || exit;

class TestNotificationRequest
{
    /**
     * @param string[] $supportedEvents Dynamic list of supported event strings
     */
    public static function getValidationRules(array $supportedEvents = []): array
    {
        if (empty($supportedEvents)) {
            $supportedEvents = array_map(
                fn(NotificationEvent $e) => $e->value,
                NotificationEvent::cases()
            );
        }

        return [
            'event' => [
                'required' => true,
                'type'     => 'string',
                'enum'     => $supportedEvents,
            ],
            'recipient' => [
                'required' => true,
                'type'     => 'string',
                'enum'     => [Recipient::Client->value, Recipient::Manager->value],
            ]
        ];
    }
}