<?hh // strict

use function DI\{create, get, add};

/**
 * Bootstrap file for the MerchantsOfHope application
 */

// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Load environment variables
if (file_exists(__DIR__ . '/../.env')) {
    $dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../');
    $dotenv->load();
}

// Define application constants
defined('APP_NAME') or define('APP_NAME', $_ENV['APP_NAME'] ?? 'MerchantsOfHope');
defined('APP_VERSION') or define('APP_VERSION', $_ENV['APP_VERSION'] ?? '0.1.0');
defined('APP_ENV') or define('APP_ENV', $_ENV['APP_ENV'] ?? 'development');
defined('DEBUG') or define('DEBUG', filter_var($_ENV['DEBUG'] ?? false, FILTER_VALIDATE_BOOLEAN));

// Set timezone
date_default_timezone_set($_ENV['TIMEZONE'] ?? 'UTC');

// Initialize autoloader
require_once __DIR__ . '/../vendor/autoload.php';

// Initialize dependency injection container
$container = DI\Container::build();