using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using OF_DL.Models.Config;

namespace OF_DL.Gui.ViewModels;

public partial class CreatorConfigRowViewModel : ViewModelBase
{
    private readonly Action<CreatorConfigRowViewModel> _onDelete;
    private readonly Action<CreatorConfigRowViewModel> _onEdit;

    [ObservableProperty] private string _username;
    [ObservableProperty] private CreatorConfig _config;

    public CreatorConfigRowViewModel(string username, CreatorConfig config, Action<CreatorConfigRowViewModel> onDelete, Action<CreatorConfigRowViewModel> onEdit)
    {
        _username = username;
        _config = config;
        _onDelete = onDelete;
        _onEdit = onEdit;
    }

    [RelayCommand]
    private void Delete() => _onDelete(this);

    [RelayCommand]
    private void Edit() => _onEdit(this);
}
