<?php

namespace App\Http\Controllers\Api\V1\Admin\Auth;

use App\Models\AdminUser;
use App\Support\ApiResponse;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use App\Http\Controllers\Controller;
use App\Support\AdminAuthProfile;

final class MeController extends Controller
{
    public function __invoke(Request $request): JsonResponse
    {
        /** @var AdminUser $admin */
        $admin = $request->lotteryAdmin();

        return ApiResponse::success([
            'admin' => AdminAuthProfile::fromAdmin($admin),
        ]);
    }
}
