<?php

namespace App\Http\Controllers\Api\V1;

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

class ClassificationController extends Controller
{
    public function __construct(private ClassificationService $service) {}

    public function index(Request $request)
    {
        return ApiResponse::handle(fn () => $this->service->index($request->all()), '분류 목록 조회');
    }

    public function show(string $id)
    {
        return ApiResponse::handle(fn () => $this->service->show((int) $id), '분류 단건 조회');
    }

    public function store(Request $request)
    {
        return ApiResponse::handle(fn () => $this->service->store($request->all()), '분류 생성');
    }

    public function update(string $id, Request $request)
    {
        return ApiResponse::handle(fn () => $this->service->update((int) $id, $request->all()), '분류 수정');
    }

    public function destroy(string $id)
    {
        return ApiResponse::handle(fn () => $this->service->destroy((int) $id), '분류 삭제');
    }
}
