using MainShell.ProcessResult;
using System;

namespace MainShell.Process
{
    public class CurrentChipStateService
    {
        private readonly ProcessResultManager _processResultManager;
        private CurrentChipLifecycleState _currentState;

        public CurrentChipStateService(ProcessResultManager processResultManager)
        {
            _processResultManager = processResultManager ?? throw new ArgumentNullException(nameof(processResultManager));
            _currentState = _processResultManager.CurrentChipState.State;
        }

        public CurrentChipLifecycleState CurrentState
        {
            get { return _currentState; }
        }

        public void SetState(CurrentChipLifecycleState chipState)
        {
            _currentState = chipState;
            _processResultManager.SaveCurrentChipState(chipState);
        }
    }
}