<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;

class DocumentationController extends Controller
{
    public function index()
    {
        $docs = [
            'wallet' => File::get(base_path('docs/wallet-api.md')),
            // Add other documentation sections here
        ];

        return response()->json([
            'success' => true,
            'data' => $docs,
            'message' => 'API documentation retrieved successfully'
        ]);
    }

    public function show($section)
    {
        $path = base_path("docs/{$section}-api.md");

        if (!File::exists($path)) {
            return response()->json([
                'success' => false,
                'message' => 'Documentation section not found'
            ], 404);
        }

        $content = File::get($path);

        return response()->json([
            'success' => true,
            'data' => [
                'section' => $section,
                'content' => $content
            ],
            'message' => 'API documentation section retrieved successfully'
        ]);
    }
}
