<?php

namespace App\Actions\Lead;

use App\Events\ModelChanged;
use App\Models\Lead;
use App\Repositories\Contracts\LeadRepositoryInterface;

final class DeleteLeadAction
{
    public function __construct(private LeadRepositoryInterface $repository) {}

    public function execute(Lead $lead): bool
    {
        $this->repository->delete($lead);

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

        return true;
    }
}
