<?php

namespace App\Livewire;

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

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

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

    public function loadTermsAndPrivacy()
    {
        // Load card types from JSON file
        $this->termsAndPrivacy = collect(json_decode(file_get_contents(storage_path('app/terms-privacy.json')), true));
    }

    public function render()
    {
        return view('livewire.about-us.terms-and-privacy', [
            'terms_and_privacy' => $this->termsAndPrivacy,  // Pass all users to the table
        ]);
    }
}
