<?php

namespace App\Components\Dsar;

use App\Models\Dsar\Dsar;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Component;

class View extends Component {
    use AuthorizesRequests;
    public Dsar $dsar;

    public function mount(): void {
        $this->authorize('dsars.view');
    }

    public function render() {
        $this->dsar->loadMissing(['institution', 'outboundMessage', 'latestResponse', 'claim.client']);

        $emailSend = $this->dsar->outboundMessage;

        return view('components.dsar.view', [
            'institution' => $this->dsar->institution,
            'emailSend'   => $emailSend,
        ]);
    }
}
