<?php

namespace App\Livewire;

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

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

    public function mount()
    {
        $this->loadLockedAccounts();  // Load users initially
    }

    public function loadLockedAccounts()
    {
        $this->lockedAccounts = collect(json_decode(file_get_contents(storage_path('app/locked-accounts.json')), true));
    }

    public function render()
    {
        return view('livewire.member-management.locked-account', [
            'locked_accounts' => $this->lockedAccounts,  // Pass all users to the table
        ]);
    }
}