<?php

declare(strict_types=1);

namespace apexl\Io\modules\user\Factories;

use apexl\Io\modules\user\entities\userEntity;
use apexl\Io\modules\user\interfaces\NewUserNotifierInterface;
use DI\Container;
use DI\DependencyException;
use DI\NotFoundException;

final readonly class NewUserNotifierFactory
{
    public function __construct(private Container $container) {}

    /**
     * @throws DependencyException
     * @throws NotFoundException
     */
    public function make(userEntity $user): NewUserNotifierInterface
    {
        $notifier = $this->container->make(NewUserNotifierInterface::class);

        $notifier->setUser($user);

        return $notifier;
    }

}
