<?php
require __DIR__.'/common.php';$report=['lane'=>$lane,'HTTP'=>0,'DML'=>0,'DDL'=>0,'passed'=>false];
try{$check(!is_file(__DIR__.'/private-request.json'),'Auth phase cannot replay');$journal=json_decode(file_get_contents(__DIR__.'/private-fixture-insert.json'),true);$check(count($journal)===($lane==='B'?2:4),'Exact approved insert count');$base=$source();foreach($journal as $entry){$row=$entry['bindings'];$matches=array_values(array_filter($base[$entry['table']],static function($r)use($row){foreach($row as $k=>$value){if($k==='create_time'||$k==='date'){$actual=$r[$k];if($actual!==$value&&$actual!==$value.'.000000')return false;}elseif(is_int($value)||is_float($value)){if(!is_numeric($r[$k])||(float)$r[$k]!== (float)$value)return false;}elseif($r[$k]!==$value)return false;}return true;}));$check(count($matches)===1,'Exact complete committed fixture '.$entry['table']);$report['actual_PK'][$entry['table']]=$matches[0]['id'];}
 $actorSHA=$lane==='B'?'1e449c21aa9f6146a1072d67ad4d8f9ae0a554d5de37e8d98587f7b0cf7ce347':'77454e3bffe2f330d0cd94db97b80553f7c7fcd7ab778e03e7cdad7562f46523';$check($base['actor_sha256']===$actorSHA,'Same approved real actor');$save('private-http-baseline.json',$base);
 require __DIR__.'/media-leaf.php';require __DIR__.'/init.php';$GLOBALS['CDX_PREPARED']=[];new \app\p\logic\NutritionTemplate();new \app\p\logic\NutritionStation();$mobile=new \app\m\logic\Nutrition();$check($GLOBALS['CDX_PREPARED']===[],'Constructor0SQL');$property=new ReflectionProperty($mobile,'sport_event_uuids');$property->setAccessible(true);$save('private-sport-source-children.json',$property->getValue($mobile));
 $actor=$q('SELECT ID,UUID,ACCOUNT,TYPE,IS_DELETE FROM '.$p.'user WHERE ID=1')[0];require_once APP_PATH.'base/Security.php';$token=\app\base\Security::encrypt(implode("\t",[(string)$actor['id'],(string)$actor['uuid'],(string)$actor['account'],'0','','',(string)$actor['account']]));
 $position=$lane==='B'?'游泳馆':'CDXTS11C7E3-station';$keyword=$lane==='B'?'冲刺能量泵速度力量运动营养粉':'CDXNP119A2B-product';
 $cases=[['label'=>'templateLists','path'=>'/p/nutrition_template/lists','params'=>['train_status'=>'1','page'=>'1','keyword'=>'CDXTS11C7E3-template']],['label'=>'templateAll','path'=>'/p/nutrition_template/listsAll','params'=>['train_status'=>'1']],['label'=>'templateInfo','path'=>'/p/nutrition_template/info','params'=>['uuid'=>$templateUUID]],['label'=>'stationLists','path'=>'/p/nutrition_station/lists','params'=>['page'=>'1','keyword'=>$position]],['label'=>'stationInfo','path'=>'/p/nutrition_station/info','params'=>['uuid'=>$stationUUID]],['label'=>'stationNutrition','path'=>'/p/nutrition_station/nutritionList','params'=>['page'=>'1','pagesize'=>'10','search_type'=>'1','keyword'=>$keyword,'station_uuid'=>$stationUUID,'num'=>'1','nutrition'=>'0','select_uuid'=>$productUUID]],['label'=>'setAggregate','path'=>'/p/nutrition_set/listsAll','params'=>['nutrition'=>'0']],['label'=>'sportRoots','path'=>'/m/nutrition/getSport','params'=>[]]];
 $save('private-cases.json',$cases);$save('private-request.json',['token'=>$token,'cases'=>$cases]);$lock=[];foreach(['p/controller/NutritionTemplate.php','p/controller/NutritionStation.php','p/controller/NutritionSet.php','m/controller/Nutrition.php','p/logic/NutritionTemplate.php','p/logic/NutritionStation.php','p/logic/Nutrition.php','m/logic/Nutrition.php','model/NutritionTemplate.php','model/NutritionTemplateExt.php','model/NutritionStation.php','model/NutritionStationExt.php','model/Nutrition.php','model/NutritionSet.php','model/NutritionTime.php','model/Annex.php','model/BaseModel.php','base/AdminController.php','common.php','route.php'] as $file)$lock[$file]=hash_file('sha256',APP_PATH.$file);$save('private-source-lock.json',$lock);$report['passed']=true;
}catch(Throwable $e){$save('private-auth-error.json',['class'=>get_class($e),'message'=>$e->getMessage(),'trace'=>$e->getTraceAsString()]);$report['failure']=['class'=>get_class($e),'reason_sha256'=>hash('sha256',$e->getMessage())];}
$save('private-auth.json',$report);$save('private-auth-select-journal.json',$GLOBALS['ORACLE_JOURNAL']);echo json_encode($report),"\n";exit($report['passed']?0:2);
