<?php

namespace App\Http\Controllers\Public;

use App\Http\Controllers\Controller;
use App\Models\Faq;
use App\Models\SeoMeta;
use App\Services\SEO\SchemaGenerator;

class PageController extends Controller
{
    public function preorder()
    {
        $seo = SeoMeta::where('url_path', '/preorder')->first();
        return view('public.preorder', compact('seo'));
    }

    public function howItWorks()
    {
        $seo = SeoMeta::where('url_path', '/how-it-works')->first();
        return view('public.how-it-works', compact('seo'));
    }

    public function about()
    {
        $seo = SeoMeta::where('url_path', '/about')->first();
        return view('public.about', compact('seo'));
    }

    public function services()
    {
        $seo = SeoMeta::where('url_path', '/services')->first();
        return view('public.services', compact('seo'));
    }

    public function faq()
    {
        $faqs = Faq::where('is_active', true)->orderBy('sort_order', 'asc')->get();
        $seo = SeoMeta::where('url_path', '/faq')->first();
        $schemaJson = SchemaGenerator::faqs($faqs);

        return view('public.faq', compact('faqs', 'seo', 'schemaJson'));
    }

    public function auctionSheet()
    {
        $seo = SeoMeta::where('url_path', '/auction-sheet')->first();
        return view('public.auction-sheet', compact('seo'));
    }

    public function contact()
    {
        $seo = SeoMeta::where('url_path', '/contact')->first();
        return view('public.contact', compact('seo'));
    }
}
