<?php

namespace App\Http\Controllers\Api\V1;

use App\Helpers\ApiResponse;
use App\Http\Controllers\Controller;
use App\Services\ComprehensiveAnalysisService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

/**
 * 종합 분석 보고서 컨트롤러
 */
class ComprehensiveAnalysisController extends Controller
{
    public function __construct(
        protected ComprehensiveAnalysisService $service
    ) {}

    /**
     * 종합 분석 데이터 조회
     */
    public function index(Request $request): JsonResponse
    {
        return ApiResponse::handle(function () use ($request) {
            $params = $request->validate([
                'date' => 'nullable|date',
            ]);

            return $this->service->getAnalysis($params);
        }, __('message.fetched'));
    }
}
