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

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

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

        public override async Task ExecuteAsync(object? parameter)
        {
            Kanal haltung = new Kanal()
            {
                Id = -1,
                Projekt = new Projekt() { Id = actualState.ProjektID },
            };
            actualState.SetHaltung(haltung);
            renavigator.Renavigate();
        }
    }
}
