<?php

namespace App\Http\Controllers\Api\Administrator;

use App\Http\Controllers\Controller;
use App\Services\Administrator\AdministratorDashboardService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class AdministratorDashboardController extends Controller
{
    public function __construct(
        protected AdministratorDashboardService $service
    ) {
    }

    public function metrics(): JsonResponse
    {
        return response()->json($this->service->metrics());
    }

    public function userSearch(Request $request): JsonResponse
    {
        return response()->json(
            $this->service->userSearch((string) $request->query('query', ''))
        );
    }
}