<?php

namespace App\Http\Controllers\Api\V1\Player;

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

/** GET /api/v1/player/auth/captcha — 玩家账号密码登录图形验证码 */
final class PlayerAuthCaptchaController extends Controller
{
    public function __invoke(AdminCaptchaService $captcha): JsonResponse
    {
        $payload = $captcha->create(AdminCaptchaService::SCOPE_PLAYER);

        return ApiResponse::success([
            'captcha_key' => $payload['captcha_key'],
            'image_base64' => $payload['image_base64'],
        ]);
    }
}
