<?php
$seed=json_decode(file_get_contents(__DIR__.'/auth-seed.json'),true);$lease=$seed['lease'];$oldWide=$seed['oldWide'];require __DIR__.'/context-private.php';
$store=$connect(false);$prefix=$lane==='B'?'ydy_':'YDY_';$rows=$full($store,$prefix.'user','ID=?',[(string)$lease['actor']['id']]);
if(count($rows)!==1||hash('sha256',json_encode($rows))!==$oldWide['actor_before']['fullrow_sha256'])throw new RuntimeException('Exact ordinary actor current full-row SHA');$actor=$rows[0];if($actor['type']!=='0'||$actor['status']!=='1'||$actor['is_delete']!=='0')throw new RuntimeException('Actor actual state');
require __DIR__.'/source/application/base/Security.php';
$parts=[$actor['id'],$actor['uuid'],$actor['name'],$actor['type'],$actor['avatar']??'',$actor['staff_uuid']??'',$actor['nickname']??'',$actor['head_img']??''];$token=\app\base\Security::encrypt(implode("\t",$parts));
$common=['biz_order_no'=>'CDXGW11B6A91C','nickname'=>'','mobile'=>'','scene'=>''];$cases=[];
foreach(['include-p1'=>['2000-12-31','2001-01-02','1','2'],'include-p2'=>['2000-12-31','2001-01-02','2','2'],'single-day'=>['2001-01-01','2001-01-01','1','100'],'exclude-day'=>['2001-01-02','2001-01-02','1','100']]as $label=>$values)$cases[$label]=$common+['start_date'=>$values[0],'end_date'=>$values[1],'page'=>$values[2],'page_size'=>$values[3]];
file_put_contents(__DIR__.'/private-request.json',json_encode(['token'=>$token,'owner'=>$lane==='B'?'44641':'1827','cases'=>$cases],JSON_UNESCAPED_UNICODE));chmod(__DIR__.'/private-request.json',0600);
file_put_contents(__DIR__.'/evidence/auth-context.json',json_encode(['actor_id'=>$actor['id'],'actor_fullrow_sha256'=>hash('sha256',json_encode($rows)),'actual_type'=>$actor['type'],'tenant'=>10001,'Auth'=>'ordinary unmodified Security format/current DB actor','SELECT'=>count($journal),'DML'=>0]));chmod(__DIR__.'/evidence/auth-context.json',0600);echo json_encode(['Auth_ready'=>true,'SELECT'=>count($journal),'DML'=>0]),"\n";
