using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using Valg.EVA.Skanning.Verify.Startup.VerifyBallotPaper.Candidate;

namespace Valg.EVA.Skanning.Verify.Startup.VerifyBallotPaper.RenumberStrikeout
{
    public class RenumberStrikeoutContextMenuViewModel : ContextMenuViewModel
    {
        private List<RenumberViewModel> possibleRenumberValues;
        private bool showRenumberOption;
        private bool isRenumberValuesOpen;
        private RenumberViewModel selected;

        public bool ShowRenumberOption
        {
            get
            {
                return showRenumberOption; 
                
            }
            set
            {
                showRenumberOption = value;
                OnPropertyChanged();
            }
        } 

        public List<RenumberViewModel> PossibleRenumberValues
        {
            get
            {
                return possibleRenumberValues;
            }
            set
            {
                possibleRenumberValues = value;
                OnPropertyChanged();
            }
        }

        public RenumberViewModel Selected
        {
            get
            {
                return selected;
            }
            set
            {
                selected = value;
                OnPropertyChanged();
            }
        }

        public bool IsRenumberValuesOpen
        {
            get
            {
                return isRenumberValuesOpen;
            }
            set
            {
                isRenumberValuesOpen = value;
                OnPropertyChanged();
            }
        }

        public UIElement CurrentUIElement { get; set; }

        public void SetPossibleRenumberValues(List<int> renumberValues)
        {
            PossibleRenumberValues = renumberValues.Select(renumberValue => new RenumberViewModel
            {
                Command = Command,
                DisplayName = renumberValue.ToString(),
                Value = renumberValue
            }).ToList();
            
            ShowRenumberOption = possibleRenumberValues != null && possibleRenumberValues.Count > 0;
        }
    }
}
