<?php

namespace App\Providers;

use App\Services\Communications\Routing\CallRoutingEngine;
use App\Services\Communications\Routing\Rules\RouteAnyAgentRule;
use App\Services\Communications\Routing\Rules\RouteAssignedAgentRule;
use App\Services\Communications\Routing\Rules\RouteQueueFallbackRule;
use App\Services\Communications\Routing\Rules\RouteVoicemailFallbackRule;
use Illuminate\Support\ServiceProvider;

class CommunicationsServiceProvider extends ServiceProvider {
    public function register(): void {
        $this->app->singleton(CallRoutingEngine::class, function ($app)
        {
            return new CallRoutingEngine([
                $app->make(RouteAnyAgentRule::class),
                $app->make(RouteQueueFallbackRule::class),
                $app->make(RouteVoicemailFallbackRule::class),
            ]);
        });
    }
}