<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Concerns\DestroysCatalogItem;
use App\Models\Etapa;
use App\Support\CatalogDeletionGuard;
use Illuminate\Http\JsonResponse;

class EtapaAdminController extends Controller
{
    use DestroysCatalogItem;

    public function destroy(Etapa $etapa): JsonResponse
    {
        $this->authorize('delete', $etapa);

        return $this->destroyCatalogItem(
            CatalogDeletionGuard::etapa($etapa),
            fn () => $etapa->delete(),
        );
    }
}
