<?php

namespace App\Http\Controllers\Api\V1;

use App\Support\ApiResponse;
use Illuminate\Http\JsonResponse;
use App\Http\Controllers\Controller;
use App\Services\LotterySettings;

final class HealthController extends Controller
{
    /**
     * 健康检查（Next / 网关探活）。路径：GET /api/v1/health
     *
     * 非调试环境不返回框架版本号，避免信息泄露。
     */
    public function __invoke(): JsonResponse
    {
        $payload = [
            'app' => config('app.name'),
            'default_currency' => LotterySettings::defaultCurrency(),
        ];

        if (config('app.debug')) {
            $payload['laravel'] = app()->version(); // 仅本地/调试
        }

        return ApiResponse::success($payload);
    }
}
