using Earthblend.Nts.Common;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Earthblend.Tts.Common.Core.Members
{
    public class Permutation : CustomBindableBase
    {
        private Guid _nodeId = Guid.Empty;
        private long _countIndex = 0;
        private Boolean _compiled = false;
        private Boolean _validEquation = false;


        public Guid NodeId { get { return _nodeId; } set { SetProperty(ref _nodeId, value); } }

        public long CountIndex
        {
            get { return _countIndex; }
            set { SetProperty(ref _countIndex, value); }
        }

        public Boolean Compiled
        {
            get { return _compiled; }
            set { SetProperty(ref _compiled, value); }
        }


        public Boolean ValidEquation
        {
            get { return _validEquation; }
            set { SetProperty(ref _validEquation, value); }
        }

        private Boolean _passedTest = false;
        public Boolean PassedTest
        {
            get { return _passedTest; }
            set { SetProperty(ref _passedTest, value); }
        }

        private long _index = 0;
        public long Index
        {
            get { return _index; }
            set { SetProperty(ref _index, value); }
        }

        private Double _equationResult = 0;
        public Double EquationResult
        {
            get { return _equationResult; }
            set { SetProperty(ref _equationResult, value); }
        }


        private String _symbols = "";
        public String Symbols
        {
            get { return _symbols; }
            set { SetProperty(ref _symbols, value); NotifyPropertyChanged("SymbolCount"); }
        }

        public int SymbolCount
        {
            get { return _symbols.Length; }
        }

        private String _translated = "";
        public String Translated
        {
            get { return _translated; }
            set { SetProperty(ref _translated, value); }
        }

        private String _errorMessage = "";
        public String ErrorMessage
        {
            get { return _errorMessage; }
            set { SetProperty(ref _errorMessage, value); }
        }


        private String _file = String.Empty;
        public String File
        {
            get { return _file; }
            set { SetProperty(ref _file, value); NotifyPropertyChanged("Name"); }
        }

        //private ObservableCollection<VirtualEquationElement> _virtualEquationElements = new ObservableCollection<VirtualEquationElement>();
        //public ObservableCollection<VirtualEquationElement> VirtualEquationElements
        //{
        //    get { return _virtualEquationElements; }
        //    set { SetProperty(ref _virtualEquationElements, value); }
        //}

        public String FileName
        {
            get
            {
                List<String> result = File.Split(@"\".ToCharArray()).ToList();
                return String.IsNullOrEmpty(File) ? "" : result.LastOrDefault();
            }
        }
    }
}