<?php

declare(strict_types=1);

namespace App\Framework\Idempotency;

use App\Framework\Cache\Cache;
use App\Framework\DI\Attributes\Initializer;
use App\Framework\DI\Container;

/**
 * Idempotency Service Initializer
 *
 * Registers IdempotencyService as singleton in DI container.
 */
final readonly class IdempotencyServiceInitializer
{
    #[Initializer]
    public function __invoke(Container $container): IdempotencyService
    {
        $cache = $container->get(Cache::class);

        return new IdempotencyService($cache);
    }
}
