<?php
declare(strict_types=1);
if($phase==='candidate_v2'&&$lane!=='C')throw new RuntimeException('V2 native regression frozen to C only');
foreach(array_merge(['dishes_weight'],$fields) as $field){$column=null;foreach($metadata['metadata']['meal_infos']['columns'] as $c)if(strtolower($c['column_name'])===$field)$column=$c;if(!$column||strtolower($column['data_type'])!=='decimal'||(int)($dm?$column['data_precision']:$column['numeric_precision'])!==10||(int)($dm?$column['data_scale']:$column['numeric_scale'])!==2)throw new RuntimeException('Frozen DEC10,2 field not proven '.$field);}
if($dm){$date=(string)$last['meal_time'];if(!preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.0{1,6}$/D',$date)||substr($date,0,4)==='0000')throw new RuntimeException('Natural timestamp precision cannot be safely projected');}
