using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveUI;
using ReactiveUI.SourceGenerators;
using Splat;
using StarsAssistant.Model;

namespace StarsAssistant.ViewModels;

public partial class MainWindowViewModel : ViewModelBase
{
    [Reactive]
    private string _dbPath;

    [Reactive]
    private BuColViewModel? _buColViewModel = new();

    public MainWindowViewModel()
    {
        using var db = Locator.Current.GetService<StarsDatabase>()!;
        DbPath = Path.GetFullPath(db.DbPath);

        this.WhenActivated((CompositeDisposable disposables) => 
        {
            // /* handle activation */
            // Disposable
            //     .Create(() => { /* handle deactivation */ })
            //     .DisposeWith(disposables);
        });
    }

    [ReactiveCommand]
    private void New() 
    {
        this.Log().Info("New button hit");
    }

    [ReactiveCommand]
    private void Open() 
    {
        this.Log().Info("Open button hit");
    }
}