using SewerStammGen.Shared.Contracts;
using SewerStammGen.Shared.Domain;
using SewerStammGen.WPF.Interface.Navigator;
using SewerStammGen.WPF.ViewModel;
using Shared.Contracts;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SewerStammGen.WPF.Commands
{
    internal class HaltungEditSaveCommand : AsyncCommandBase
    {
        private readonly HaltungEditViewModel _haltungEditViewModel;
        private readonly IHaltungDataService _haltungDataService;
        private readonly IRenavigator _renavigator;

        public HaltungEditSaveCommand(IHaltungDataService haltungDataService,IRenavigator renavigator,HaltungEditViewModel haltungEditViewModel)
        {
            this._haltungEditViewModel = haltungEditViewModel;
            this._haltungDataService = haltungDataService;
            this._renavigator = renavigator;
        }

        public override async Task ExecuteAsync(object? parameter)
        {
            _haltungEditViewModel.Model = await _haltungDataService.Update(_haltungEditViewModel.Model);

            _renavigator.Renavigate();
        }
    }
}
