<?php

namespace App\Actions\GuideCard;

use App\Events\ModelChanged;
use App\Models\GuideCard;
use App\Repositories\Contracts\GuideCardRepositoryInterface;

final class DeleteGuideCardAction
{
    public function __construct(private GuideCardRepositoryInterface $repository) {}

    public function execute(GuideCard $guideCard): bool
    {
        $this->repository->delete($guideCard);

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

        return true;
    }
}
