<?php

declare(strict_types=1);

namespace Apexl\Io\Notifier\Notifiers;

use Apexl\Io\Notifier\Exceptions\NotifierException;
use Apexl\Io\Notifier\Interfaces\NotifierInterface;
use Exception;

class MultipleNotifier extends Notifier implements NotifierInterface
{
    /**
     * @param NotifierInterface[] $notifiers
     * @throws Exception
     */
    public function __construct(private readonly array $notifiers)
    {
        parent::__construct();
    }

    /**
     * @throws NotifierException
     */
    public function send(): void
    {
        foreach ($this->notifiers as $notifier) {
            $notifier->send();
        }
    }
}
