using SewerStammGen.Shared.Domain;
using Shared.Contracts;
using StammGenerator.Commands;
using StammGenerator.Interface;
using StammGenerator.ViewModel;
using System.Threading.Tasks;

namespace StammGenerator.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();

        }
    }
}
