<?php

namespace App\Http\Controllers\Admin\System;

use App\Http\Controllers\Controller;
use App\Http\Requests\PaginatedRequest;
use App\Services\Admin\System\FormHistoryService;
use Inertia\Inertia;
use Inertia\Response;

class FormHistoryController extends Controller
{
    public function __construct(
        private FormHistoryService $service
    ) {}

    public function index(PaginatedRequest $request): Response
    {
        return Inertia::render('admin/system/form-histories/index', [
            'formHistories' => $this->service->paginated(...$request->validatedWithDefaults()),
            'modules' => $this->service->getModules(),
            'events' => $this->service->getEvents(),
        ]);
    }
}
