<?php

namespace App\Framework\Smartlinks;

use App\Framework\DI\Container;
use App\Framework\DI\Initializer;
use App\Framework\Smartlinks\Actions\ActionRegistry;
use App\Framework\Smartlinks\Actions\DefaultActionRegistry;
use App\Framework\Smartlinks\Actions\EmailVerificationAction;
use App\Framework\Smartlinks\Services\CacheSmartLinkService;
use App\Framework\Smartlinks\Services\SmartlinkService;

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

    #[Initializer]
    public function __invoke(): ActionRegistry
    {
        $registry = new DefaultActionRegistry;

        $registry->register(new EmailVerificationAction());

        return $registry;
    }

    #[Initializer]
    public function init(): SmartlinkService
    {
        return $this->container->get(CacheSmartLinkService::class);
    }
}
