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

namespace StammGenerator.Commands
{
    class SchachtAddCommand : AsyncCommandBase
    {
        private readonly IActualState actualState;
        private readonly IRenavigator renavigator;
        

        public SchachtAddCommand(IActualState actualState, IRenavigator renavigator)
        {
            this.actualState = actualState;
            this.renavigator = renavigator;
        }

        public override async Task ExecuteAsync(object? parameter)
        {
            Schacht newSchacht = new Schacht()
            {
                Projekt = new Projekt() { Id = actualState.ProjektID },
            };
            actualState.SetSchacht(newSchacht);
            renavigator.Renavigate();
        }
    }
}
