using SewerStammGen.Enum;
using SewerStammGen.WPF.Interface;
using SewerStammGen.WPF.Interface.Navigator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SewerStammGen.WPF.Commands
{
    internal class UpdateCurrentViewModelCommand : AsyncCommandBase
    {
        private INavigator _navigator;
        private readonly IViewModelAbstractFactory _viewModelFactory;

        public UpdateCurrentViewModelCommand(INavigator navigator, IViewModelAbstractFactory viewModelFactory)
        {
            _navigator = navigator;
            _viewModelFactory = viewModelFactory;
        }

        public override async Task ExecuteAsync(object? parameter)
        {
            if(parameter is EMainWindowViewType)
            {
                EMainWindowViewType viewType = (EMainWindowViewType)parameter;
                _navigator.CurrentViewModel = _viewModelFactory.CreateViewModel(viewType);
            }
        }
    }
}
