<?php

namespace App\Http\Controllers\Synapse;

use App\Http\Controllers\Controller;
use App\Models\Claim\Claim;
use App\Models\Synapse\SynapseRun;

class DsarReportController extends Controller
{
    public function show(Claim $claim)
    {
        $run = SynapseRun::where('agent_type', 'dsar_identifier')
            ->where('subject_type', Claim::class)
            ->where('subject_id', $claim->id)
            ->whereNotNull('result')
            ->latest()
            ->firstOrFail();

        return view('synapse.dsar-report', [
            'claim'  => $claim,
            'result' => $run->result,
            'run'    => $run,
        ]);
    }
}
