<?php

require_once __DIR__ . '/../Fury/fury.php';
require_once __DIR__ . '/TestApp.php';

// PHPUnit auto-loads via composer, but Fury's own autoloader
// handles the legacy namespace-to-path mapping.
// We just need to ensure Fury/__autoload.php is included (done via fury.php).

$tb = new \Fury\Modules\ThinBuilder\ThinBuilder([
	'dblib' => 'sqlite',
	'dbname' => ':memory:',
], null, false);

$testApp = new TestApp();
$testApp->thin_builder = $tb;
$testApp->utils = new \SHServ\Utils();
$testApp->sessions = new \SHServ\Sessions();
$testApp->devtools = new \SHServ\DevTools();

\Fury\Kernel\AppContainer::set_app($testApp);

// Minimal FCONF for message lookups in Utils
if (!defined('FCONF')) {
	define('FCONF', [
		'app_name' => 'TestApp',
		'text_msgs' => [
			'not_found' => 'Not found',
			'invalid_request' => 'Invalid request',
			'rate_limit_exceeded' => 'Too many requests',
			'unauthorized' => 'Unauthorized',
			'forbidden' => 'Forbidden',
			'device_not_found' => 'Device not found',
			'script_not_exists' => 'Script not found',
			'area_not_found' => 'Area not found',
			'invalid_input' => 'Invalid input',
			'internal_error' => 'Internal server error',
			'invalid_alias' => 'Invalid alias format',
			'empty_field' => 'Field cannot be empty',
			'alias_already_exists' => 'Alias already exists',
			'invalid_id' => 'Invalid identifier',
			'area_not_exists' => 'Area does not exist',
			'undefined_error' => 'Undefined error',
			'invalid_ip' => 'Invalid IP address',
			'invalid_json' => 'Invalid JSON format',
			'invalid_params' => 'Invalid parameters',
			'invalid_action' => 'Invalid action alias',
			'invalid_state' => 'Invalid state value',
			'wrong_status_name' => 'Wrong status name',
			'action_script_not_found' => 'Action script not found',
			'scope_not_found' => 'Scope not found',
			'file_not_exists' => 'File does not exist',
			'invalid_path' => 'Invalid path',
			'device_request_fail' => 'Device request failed',
			'parent_area_not_found' => 'Parent area not found',
		],
	]);
}
