json($w->listing($r->user()->id,$r->query()))->header('Cache-Control','no-store, private');} public function preview(Request $r,WorkshopEquipment $w){return response()->json($w->preview($r->user()->id,$r->all(),strtolower((string)$r->header('Idempotency-Key'))))->header('Cache-Control','no-store');} public function confirm(Request $r,WorkshopEquipment $w){$d=$r->validate(['preview'=>'required|string|max:65536']);abort_if(array_diff(array_keys($r->all()),['preview']),422);try{return response()->json($w->confirm($r->user()->id,$d['preview']))->header('Cache-Control','no-store');}catch(\Illuminate\Database\QueryException $e){if(!in_array($e->errorInfo[0]??null,['55P03','57014'],true))throw $e;return response()->json(['message'=>'Registo ocupado. Recupere a mesma confirmação.'],503)->header('Retry-After','5');}} }