<?php
declare(strict_types=1);

// Base classes first: PHP resolves `extends`/`implements` at load time, so the
// interface and AbstractProvider must exist before any concrete provider.
$dir = __DIR__;
foreach (['ProviderInterface', 'HttpClient', 'JwtVerifier', 'AbstractProvider'] as $file) {
    require_once $dir . '/' . $file . '.php';
}

// Then every *Provider.php present. Discovered rather than listed, because the
// previous hardcoded list silently omitted newly added providers and they died
// at runtime with "class not found".
foreach (glob($dir . '/*Provider.php') ?: [] as $file) {
    if (basename($file) === 'AbstractProvider.php') continue;
    require_once $file;
}

foreach (['SocialAuthManager', 'SocialAccountService'] as $file) {
    require_once $dir . '/' . $file . '.php';
}

return require $dir . '/config.php';
