using SewerStammGen.Shared.Domain;
using SewerStammGen.WPF.Interface.Navigator;
using SewerStammGen.WPF.ViewModel;
using SewerStammGen.WPF.ViewModel.State;
using Shared.Contracts;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;

namespace SewerStammGen.WPF.Commands
{
    internal class ProjektEditCommand : AsyncCommandBase
    {
        private IDataService<Projekt> _dataService;
        private IActualState _actualState;
        private IRenavigator _renavigator;
        private ProjektListViewModel _projektListViewModel;


        public ProjektEditCommand(IDataService<Projekt> dataService, IActualState actualState, IRenavigator renavigator, ProjektListViewModel projektListViewModel)
        {
            _dataService = dataService;
            _actualState = actualState;
            _renavigator = renavigator;
            _projektListViewModel = projektListViewModel;
        }

        public override async Task ExecuteAsync(object? parameter)
        {

            _actualState.SetProjekt(_projektListViewModel.SelectedProjekt);
            _renavigator.Renavigate();

        }
    }
}
