<?php

namespace App\Livewire;

use Livewire\Component;
use Livewire\Attributes\Layout;  // Required for layout declaration

#[Layout('layouts.dashboard')]  // Attribute syntax for Laravel 11
class StationRatingReport extends Component
{
    public $stationRating = [];

    public function mount()
    {
        $this->loadStationRating();  // Load stationRating initially
    }

    public function loadStationRating()
    {
        $this->stationRating = collect(json_decode(file_get_contents(storage_path('app/station-rating.json')), true));
    }

    public function render()
    {
        return view('livewire.report.station-rating-report', [
            'stationRating' => $this->stationRating, 
        ]);
    }
}
