<?php

namespace App\Providers;

use App\Core\IpAllocator\AllocatorManager;
use Illuminate\Support\ServiceProvider;

class IpAllocatorServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->app->singleton(AllocatorManager::class, function () {
            $manager = new AllocatorManager();
            foreach (config('ipallocator.allocators', []) as $key => $class) {
                $manager->register($key, $class);
            }
            return $manager;
        });
    }
}
