<?php

namespace App\Actions\Menu;

use App\Events\ModelChanged;
use App\Models\Menu;
use App\Repositories\Contracts\MenuRepositoryInterface;

final class DeleteMenuAction
{
    public function __construct(private MenuRepositoryInterface $repository) {}

    public function execute(Menu $menu): bool
    {
        $this->repository->delete($menu);

        ModelChanged::dispatch(Menu::class, 'deleted');

        return true;
    }
}
