<?php

namespace App\Components\Client\Witness;

use App\Components\Client\Concerns\InteractsWithWitnessStatement;
use App\Models\Client\Client;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Component;

/**
 * Concept 4 — Review dashboard. Organised around outstanding issues, review
 * status and completion rather than the questionnaire order. Best for QA and
 * pre-generation sign-off: triage lists drill into the exact question.
 */
class WitnessReviewDashboard extends Component
{
    use AuthorizesRequests, InteractsWithWitnessStatement;

    /** Which triage list is expanded into the working panel. */
    public string $focus = 'required';

    public function mount(Client $client): void
    {
        $this->authorize('clients.witness.view');
        $this->designMode = request()->routeIs('clients.witness.concept.*');
        $this->demoState = $this->designMode ? request()->query('state') : null;
        $this->bootWitnessWorkspace($client);
    }

    public function setFocus(string $focus): void
    {
        $this->focus = $focus;
    }

    public function render()
    {
        return view('components.client.witness.witness-review-dashboard', $this->witnessData())
            ->layout('layouts.dashboard');
    }
}
