<?php

namespace App\Http\Controllers\User;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class GuideController extends Controller
{
    public function index()
    {
        return view('app.main.guide');
    }

    // API endpoint for loading guide data (for AJAX infinite scroll)
    public function fetch(Request $request)
    {
        $page = $request->get('page', 1);

        // Example data (replace with DB query if you store guides in DB)
        $data = [
            [
                'link' => 'url/1',
                'img' => '/static/home/images/guide1.jpg',
                'title' => 'How to Deposit',
                'content' => 'Step by step instructions for making deposits',
                'createTime' => now()->toDateTimeString(),
            ],
            [
                'link' => 'url/2',
                'img' => '/static/home/images/guide2.jpg',
                'title' => 'How to Withdraw',
                'content' => 'Easy withdrawal process explained',
                'createTime' => now()->toDateTimeString(),
            ],
        ];

        return response()->json([
            'code' => 200,
            'data' => $data,
        ]);
    }
}
