<?php

namespace App\Traits;

use Livewire\Attributes\On;

trait WithConfirmation
{
    public ?string $confirmingId = null;

    public ?string $confirmingTitle = null;

    public ?string $confirmingMessage = null;

    public ?string $confirmingButtonText = null;

    #[On('fn:confirmDelete')]
    public function confirmDelete(
        string $id,
        string $title = 'Apakah Anda yakin?',
        string $message = 'Data yang berelasi dengan data ini juga akan ikut terhapus.',
        string $confirmButtonText = 'Ya, Hapus'
    ) {
        $this->confirmingId = $id;
        $this->confirmingTitle = $title;
        $this->confirmingMessage = $message;
        $this->confirmingButtonText = $confirmButtonText;
    }
}
