<?php

namespace App\Actions\HeroSlide;

use App\Events\ModelChanged;
use App\Models\HeroSlide;
use App\Repositories\Contracts\HeroSlideRepositoryInterface;

final class DeleteHeroSlideAction
{
    public function __construct(private HeroSlideRepositoryInterface $repository) {}

    public function execute(HeroSlide $heroSlide): bool
    {
        $this->repository->delete($heroSlide);

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

        return true;
    }
}
