using System;

//using System.Windows.Input;
using Windows.UI.Xaml.Input;

using Flashcard.Models;

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace Flashcard.ViewModels {

    public class MainViewModel : ViewModelBase {

        private Question _question = new Question();
        public ICommand GenerateCommand { get; set; }
        public ICommand AnswerCommand { get; set; }

        public MainViewModel() {
            this.GenerateCommand = new RelayCommand(() => this.Question = new Question());
            this.AnswerCommand = new RelayCommand<Answer>(OnAnswer);
        }

        public Question Question {
            get { return _question; }
            set {
                if (_question != value) {
                    _question = value;
                    RaisePropertyChanged("Question");
                }
            }
        }

        private void OnAnswer(Answer a) {
            a.Status = a.IsCorrect ? AnswerStatus.Correct : AnswerStatus.Incorrect;
        }

    }
}
