<?php

declare(strict_types=1);

use DI\ContainerBuilder;

require_once __DIR__ . '/env.php';

$projectRoot = dirname(__DIR__);
$autoload = $projectRoot . '/vendor/autoload.php';
if (! is_file($autoload)) {
    throw new RuntimeException(
        'Dependencias PHP no instaladas. Ejecuta: composer install en api_model',
    );
}
require $autoload;

apimodel_load_dotenv($projectRoot);

$builder = new ContainerBuilder();
/** @var callable(string): array<string, mixed> $definitions */
$definitions = require __DIR__ . '/container.php';
$builder->addDefinitions($definitions($projectRoot));

return $builder->build();
