<?php

declare(strict_types=1);

namespace App\Http\Controllers\Web;

use App\Http\Controllers\Controller;
use App\Support\Seo\SeoFactory;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;

final class TroubleshootingHelpPageController extends Controller
{
    public function __invoke(Request $request): Response
    {
        $canonical = route('help.troubleshooting');
        $seo = app(SeoFactory::class)
            ->collectionPage(
                'Troubleshooting Help — Skinbase',
                'Use fast, support-oriented troubleshooting guidance for login issues, permissions confusion, publishing blockers, profile setup problems, and bug-report escalation on Skinbase Nova.',
                $canonical,
            )
            ->toArray();

        $seo['og_type'] = 'article';

        return Inertia::render('Help/TroubleshootingHelpPage', [
            'title' => 'Troubleshooting Help',
            'description' => 'Use diagnosis-first help when something feels broken, blocked, or unclear and you need the fastest next step instead of a long module guide.',
            'seo' => $seo,
            'links' => [
                'help_home' => route('help'),
                'help_auth' => route('help.auth'),
                'help_account' => route('help.account'),
                'help_profile' => route('help.profile'),
                'studio_help' => route('help.studio'),
                'upload_help' => route('help.upload'),
                'groups_help' => route('help.groups'),
                'groups_faq' => route('help.groups.faq'),
                'profile_settings' => route('dashboard.profile'),
                'open_studio' => route('studio.index'),
                'login' => route('login'),
                'register' => route('register'),
                'password_request' => route('password.request'),
                'contact_support' => route('contact.show'),
                'report_issue' => route('bug-report'),
            ],
            'auth' => [
                'signed_in' => $request->user() !== null,
            ],
        ])->rootView('collections');
    }
}