using Valg.EVA.Skanning.Contracts.Security;
using Prism.Commands;

namespace Valg.EVA.Skanning.UserInterfaceElements.EmergencyMode
{
    public class SelectCountingAsViewModel : ViewModelBase, IConfigureEmergencyModeDetailModel
    {
        private bool isNextButtonEnabled;

        public SelectCountingAsViewModel()
        {
            RadioButtonSelectedCommand = new DelegateCommand<string>(RadioButtonSelected);
        }

        public DelegateCommand<string> RadioButtonSelectedCommand { get; private set; }

        public bool IsNextButtonEnabled
        {
            get { return isNextButtonEnabled; }
            set
            {
                if (isNextButtonEnabled != value)
                {
                    isNextButtonEnabled = value;
                    OnPropertyChanged();
                }
            }
        }

        public bool IsNextButtonVisible => true;
        public string NextButtonText => Resources.Language.LanguageString.Button_Next;

        public string Title => Resources.Language.LanguageString.EmergencyMode_SelectCountingAsView_Title;

        public CountingAs CurrentCountingAs { get; set; }
        
        
        private void RadioButtonSelected(string countingAs)
        {
            CurrentCountingAs = (CountingAs)System.Enum.Parse(typeof(CountingAs), countingAs, true);
            IsNextButtonEnabled = true;
        }
    }
}
