<?php

declare(strict_types=1);

namespace App\Framework\Notification;

use App\Framework\Notification\Dispatcher\DispatchStrategy;

/**
 * Null Notification Dispatcher
 *
 * No-op implementation for testing and development environments
 * where notifications should be silently ignored.
 */
final readonly class NullNotificationDispatcher implements NotificationDispatcherInterface
{
    public function sendNow(
        Notification $notification,
        DispatchStrategy $strategy = DispatchStrategy::ALL
    ): NotificationResult {
        // Return empty successful result
        return new NotificationResult($notification, []);
    }

    public function sendLater(Notification $notification): void
    {
        // Do nothing - notifications are silently ignored
    }

    public function send(
        Notification $notification,
        bool $async = true,
        DispatchStrategy $strategy = DispatchStrategy::ALL
    ): ?NotificationResult {
        if ($async) {
            $this->sendLater($notification);
            return null;
        }

        return $this->sendNow($notification, $strategy);
    }
}
