<?php
function expectedInfo(){global $runtime;$cat=json_decode(file_get_contents($runtime.'/catalog-oracle.json'),true);$d=[];foreach(['糖尿病','高血压','高血脂','高尿酸'] as $i=>$name)$d[]=['name'=>$name,'value'=>$i+1,'is_checked'=>$i===3?1:0];$d[]=['name'=>'无','value'=>0,'is_checked'=>0];$habit=[];foreach($cat[2] as $r)$habit[]=['enum_key'=>$r['enum_key'],'enum_name'=>$r['enum_name'],'people'=>$r['people'],'ratio'=>$r['ratio']===null?null:bcadd((string)$r['ratio'],'0',2),'checked'=>$r['enum_key']==3?1:0];$out=['disease'=>$d,'habit'=>$habit,'sport'=>['id'=>0,'name'=>'']];foreach([14=>'foodAllergy',15=>'foodAvoidance',16=>'dietaryPreference',17=>'otherConcerns'] as $type=>$name){$out[$name]=[];foreach($cat[$type] as $r)$out[$name][]=['enum_key'=>$r['enum_key'],'enum_name'=>$r['enum_name'],'is_checked'=>0];}return $out;}
function checkDTO($label,$r){global $runtime;$d=json_decode($r['raw_response_body'],true,512,JSON_THROW_ON_ERROR);ck($r['http_status']===200&&array_keys($d)===['status','message','data','trace_id']&&$d['status']===200&&$d['message']==='success'&&is_string($d['trace_id'])&&preg_match('/^[0-9a-f]{13}$/D',$d['trace_id']),'Full original envelope');$want=json_decode(file_get_contents($runtime.'/expected-DTO.json'),true)[$label];ck(json_encode($d['data'],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES)===json_encode($want,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES),'Whole source independent typed/ordered DTO');saveOnce('oracle-'.$label.'.json',['full_typed_ordered_DTO'=>true,'expected_data'=>$want]);}
