<?php
/**
 * 子进程：SimulationRouteResolver 在 zp + 白名单时应走真实页
 */
$root = dirname(__DIR__);
$_SERVER['PHP_SELF']            = '/index.php';
$_SERVER['HTTP_HOST']           = 'test.local';
$_SERVER['REMOTE_ADDR']         = '8.8.8.8';
$_SERVER['HTTP_USER_AGENT']     = 'Mozilla/5.0';
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-US';
$_SERVER['SERVER_PORT']         = 443;
$_SERVER['HTTPS']              = 'on';
$_GET                            = [];

require_once $root . '/cong.php';
session_start();
$_SESSION = [
    'cloak_whitelist_fast' => true,
    'check_result'         => 'true',
    'visit_to_3'           => '3',
];

include $root . '/tools/fixtures/regression_zp_whitelist.php';
require_once $root . '/lib/bootstrap.php';
require_once $root . '/lib/Cloak/SimulationRouteResolver.php';

$v_info = new visitorInfo();
$v_info->get_visitor_Info(COSTM_IP_SCORE, CHECK_KEY, SHOW_SITE_COUNTRY);
$logs = [
    'site_name'    => 'test.local',
    'customers_ip' => $v_info->v_ip,
    'country'      => 'US',
    'result'       => 'true',
    'reason'       => '白名单',
];
$sim = SimulationRouteResolver::dispatch([
    'v_info'      => $v_info,
    'logs'        => $logs,
    'config_name' => 'index',
    'reason'      => '白名单',
    'model'       => 'PC',
]);

echo json_encode([
    'ok'    => ($sim['branch'] ?? '') === 'fp_page' && ($sim['needs_secondary'] ?? true) === false,
    'sim'   => $sim,
], JSON_UNESCAPED_UNICODE);
