<?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 AuthHelpPageController extends Controller
{
    public function __invoke(Request $request): Response
    {
        $canonical = route('help.auth');
        $seo = app(SeoFactory::class)
            ->collectionPage(
                'Signup and Login Help — Skinbase',
                'Learn how signup, login, password recovery, verification, and account access work on Skinbase, with clear guidance for common access problems and practical next steps.',
                $canonical,
            )
            ->toArray();

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

        return Inertia::render('Help/AuthHelpPage', [
            'title' => 'Signup & Login Help',
            'description' => 'Get clear help for account creation, sign-in, password recovery, verification basics, and common access problems on Skinbase.',
            'seo' => $seo,
            'links' => [
                'help_home' => route('help'),
                'help_profile' => route('help.profile'),
                'studio_help' => route('help.studio'),
                'groups_help' => route('help.groups'),
                'help_account' => route('help.account'),
                'help_troubleshooting' => route('help.troubleshooting'),
                'login' => route('login'),
                'register' => route('register'),
                'password_request' => route('password.request'),
                'verification_notice' => route('verification.notice'),
                'open_studio' => route('studio.index'),
                'profile_settings' => route('dashboard.profile'),
                'contact_support' => route('contact.show'),
                'report_issue' => route('bug-report'),
            ],
            'auth' => [
                'signed_in' => $request->user() !== null,
            ],
        ])->rootView('collections');
    }
}