<?php

namespace App\Traits\Components;

use Livewire\Attributes\On;

trait WithConfirmation
{
    public ?string $confirmingId = null;

    public ?string $target = 'delete';

    #[On('fn:confirmAction')]
    public function confirmAction(
        string $id,
        string $target = 'delete'
    ): void {
        $this->confirmingId = $id;
        $this->target = $target;
    }
}
