<?php

namespace App\Http\Controllers\Api\V1;

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

class TodayIssueController extends Controller
{
    public function __construct(
        private readonly TodayIssueService $todayIssueService
    ) {}

    /**
     * 오늘의 이슈 리스트 조회
     */
    public function summary(Request $request): JsonResponse
    {
        $limit = (int) $request->input('limit', 30);

        return ApiResponse::handle(function () use ($limit) {
            return $this->todayIssueService->summary($limit);
        }, __('message.fetched'));
    }
}