<?php

declare(strict_types=1);

use App\Config\Database;
use App\Repositories\PedidoRepository;
use App\Repositories\PedidoTrackingRepository;
use App\Repositories\RepartidorRepository;
use App\Repositories\ReporteRepository;
use App\Repositories\TiendaRepository;
use App\Repositories\UsuarioRepository;
use App\Repositories\ZonaRepository;
use App\Services\CotizacionService;
use App\Services\JwtService;
use App\Services\PushService;
use App\Services\TrackingService;
use DI\ContainerBuilder;
use Psr\Http\Message\ResponseFactoryInterface;
use Slim\Psr7\Factory\ResponseFactory;

return function (ContainerBuilder $containerBuilder) {
    $containerBuilder->addDefinitions([
        ResponseFactoryInterface::class => fn () => new ResponseFactory(),

        PDO::class => fn () => Database::connection(),

        JwtService::class => fn () => new JwtService(),
        PushService::class => fn () => new PushService(),

        UsuarioRepository::class => fn ($c) => new UsuarioRepository($c->get(PDO::class)),
        ZonaRepository::class => fn ($c) => new ZonaRepository($c->get(PDO::class)),
        PedidoRepository::class => fn ($c) => new PedidoRepository($c->get(PDO::class)),
        PedidoTrackingRepository::class => fn ($c) => new PedidoTrackingRepository($c->get(PDO::class)),
        RepartidorRepository::class => fn ($c) => new RepartidorRepository($c->get(PDO::class)),
        TiendaRepository::class => fn ($c) => new TiendaRepository($c->get(PDO::class)),
        ReporteRepository::class => fn ($c) => new ReporteRepository($c->get(PDO::class)),

        CotizacionService::class => fn ($c) => new CotizacionService($c->get(ZonaRepository::class)),
        TrackingService::class => fn ($c) => new TrackingService($c->get(PedidoTrackingRepository::class)),
    ]);
};
