<?php

namespace App\Http\Controllers\Public;

use App\Http\Controllers\Controller;
use App\Models\HelpFaq;
use App\Models\Setting;
use Illuminate\Http\Request;

class HelpController extends Controller
{
    public function index()
    {
        if (!Setting::getValue('help_page_enabled', '1')) {
            return redirect()->route('home')->with('error', 'Help page is currently unavailable.');
        }

        $faqs = HelpFaq::getAllGrouped();
        $faqCategories = HelpFaq::getCategories();
        $supportEmail = Setting::getValue('help_support_email', 'support@theminiport.com');

        return view('public.help', compact('faqs', 'faqCategories', 'supportEmail'));
    }
}
