<?php

use Helpers\Session\ParseBase1;
use Psr\Container\ContainerInterface;

if ((new ParseBase1())->getEnvName() == '' || !isset((new ParseBase1())->getOxaSql()->Server) ||  (isset((new ParseBase1())->getOxaSql()->Server) && (new ParseBase1())->getOxaSql()->Server =='')) {
    $configUser = new \Helpers\Roles\ParseConfigFile(\Helpers\Roles\ParseConfigFile::getDirectoryBase1());
    $configUser->getConfigContents();
}

return [
    'database.hostSQL' => (new ParseBase1())->getOxaSql()->Server,
    'database.usernameSQL' => (new ParseBase1())->getOxaSql()->Login,
    'database.passwordSQL' => (new ParseBase1())->getOxaSql()->Password,
    'database.nameSQL' => (new ParseBase1())->getOxaSql()->Name,
        
    \PDO::class => function (ContainerInterface $c) {
        return new \Skeleton\Pdo\PdoSkeletonV2(
            "odbc:Driver={ODBC Driver 18 for SQL Server};TrustServerCertificate=yes;MARS_Connection=yes;Server="
            . $c->get('database.hostSQL')
            . ";database=" . $c->get('database.nameSQL'),
            $c->get('database.usernameSQL'),
            $c->get('database.passwordSQL'),
            [
                "MARS_Connection" => "yes",
                'TDS_Version' => "7.2",
            ]
        );
    }
        
];
