using System;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace HC_APTBS.ViewModels.Dialogs
{
///
/// Generic Yes/No (or Confirm/Cancel) modal dialog view-model.
///
/// Reusable across abort-test, skip-phase, delete-pump, and any future
/// binary decision prompt. Caller sets , ,
/// , before showing the dialog,
/// then inspects after the dialog closes.
///
public sealed partial class ConfirmDialogViewModel : ObservableObject
{
/// Window title.
[ObservableProperty] private string _title = string.Empty;
/// Body message — may be multi-line.
[ObservableProperty] private string _message = string.Empty;
/// Text shown on the positive-action button (defaults to a localised "OK").
[ObservableProperty] private string _confirmText = "OK";
/// Text shown on the cancel button (defaults to a localised "Cancel").
[ObservableProperty] private string _cancelText = "Cancel";
/// True when the operator clicked ; false on cancel/close.
public bool Accepted { get; private set; }
/// Raised when the dialog should close itself.
public event Action? RequestClose;
/// Accepts the prompt — sets to true and closes.
[RelayCommand]
private void Confirm()
{
Accepted = true;
RequestClose?.Invoke();
}
/// Cancels the prompt — leaves false and closes.
[RelayCommand]
private void Cancel()
{
Accepted = false;
RequestClose?.Invoke();
}
}
}