<?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 HelpCenterPageController extends Controller
{
    public function __invoke(Request $request): Response
    {
        $canonical = route('help');
        $seo = app(SeoFactory::class)
            ->collectionPage(
                'Help Center — Skinbase',
                'Find help, guides, quickstarts, FAQs, and troubleshooting for Skinbase, including Groups, Studio, Upload, Cards, Profile, and account access.',
                $canonical,
            )
            ->toArray();

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

        return Inertia::render('Help/HelpCenterPage', [
            'title' => 'Help Center',
            'description' => 'Find guides, quickstarts, FAQs, and troubleshooting for Skinbase in one structured help hub.',
            'seo' => $seo,
            'links' => [
                'studio_help' => route('help.studio'),
                'upload_help' => route('help.upload'),
                'help_worlds' => route('help.worlds'),
                'groups_documentation' => route('help.groups'),
                'groups_quickstart' => route('help.groups.quickstart'),
                'groups_faq' => route('help.groups.faq'),
                'groups_directory' => route('groups.index'),
                'group_studio' => route('studio.groups.index'),
                'create_group' => route('studio.groups.create'),
                'open_studio' => route('studio.index'),
                'studio_home' => route('studio.index'),
                'studio_content' => route('studio.content'),
                'studio_artworks' => route('studio.artworks'),
                'studio_worlds' => route('studio.worlds.index'),
                'studio_worlds_create' => route('studio.worlds.create'),
                'studio_cards' => route('studio.cards.index'),
                'studio_drafts' => route('studio.drafts'),
                'cards_create' => route('studio.cards.create'),
                'upload' => route('upload'),
                'worlds_index' => route('worlds.index'),
                'create_world' => route('worlds.create.redirect'),
                'cards_index' => route('cards.index'),
                'help_cards' => route('help.cards'),
                'help_profile' => route('help.profile'),
                'help_auth' => route('help.auth'),
                'help_account' => route('help.account'),
                'help_troubleshooting' => route('help.troubleshooting'),
                'profile_settings' => route('dashboard.profile'),
                'login' => route('login'),
                'register' => route('register'),
                'password_request' => route('password.request'),
                'help_upload' => route('help', ['q' => 'upload']),
                'contact_support' => route('contact.show'),
                'report_issue' => route('bug-report'),
            ],
            'auth' => [
                'signed_in' => $request->user() !== null,
            ],
        ])->rootView('collections');
    }
}