<?php
declare(strict_types=1);
require_once __DIR__.'/../shared/lib/notices.php';
$cases=[];foreach([[10,100,1,1],[11,101,1,1],[12,102,1,2],[13,103,2,1]] as [$user,$student,$dept,$campus]){[$sql,$args]=notice_visibility(['id'=>$user,'role'=>'student'],['student_id'=>$student,'department_id'=>$dept,'campus_id'=>$campus]);$cases[]=['id'=>$user,'sql'=>$sql,'args'=>$args];}
foreach(['javascript:alert(1)','//evil.test','data:text/html,hi','https://user:pass@example.test'] as $url){$bad=false;try{notice_link($url);}catch(InvalidArgumentException){$bad=true;}if(!$bad)throw new RuntimeException('Unsafe notice link accepted.');}
if(notice_link('/slps/resource')!=='/slps/resource')throw new RuntimeException('Internal link rejected.');
echo json_encode($cases,JSON_THROW_ON_ERROR);
