<?php

namespace App\Livewire;

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

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

    public function mount()
    {
        $this->loadMobileUsageReport();  // Load mobileUsageReport initially
    }

    public function loadMobileUsageReport()
    {
        $this->mobileUsageReport = collect(json_decode(file_get_contents(storage_path('app/mobile-usage.json')), true));
    }

    public function render()
    {
        return view('livewire.report.mobile-usage-report', [
            'mobileUsageReport' => $this->mobileUsageReport, 
        ]);
    }
}
