using Earthblend.Nts.Common;
using System;
using System.Collections.ObjectModel;

namespace Earthblend.Tts.Common.Core.Members
{
    [Serializable]
    public class PermutationRule : CustomBindableBase
    {
        public PermutationRule()
        {
            RuleName = Guid.NewGuid().ToString();
            Comparision = "HasPattern";
        }

        private ObservableCollection<PermutationRule> _children = new ObservableCollection<PermutationRule>();
        public ObservableCollection<PermutationRule> Children { get { return _children; } set { if (_children == value) return; SetProperty(ref _children, value); } }

        #region Private Variables

        private int _executionSequence = 0;
        private String _ruleName = String.Empty;
        private String _comparision = String.Empty;
        private String _value = String.Empty;
        private long _catches = 0;
        private String _example = String.Empty;
        private Guid _nodeId = Guid.Empty;
        private String _description = String.Empty;
        private String _color = "White";

        #endregion

        public void IncrementCatches()
        {
            _catches++;
        }

        public void SetExample(String example)
        {
            _example = example;
        }

        #region Public Clr Properties

        public Guid NodeId { get { return _nodeId; } set { if (_nodeId == value) return; SetProperty(ref _nodeId, value); } }
        public int ExecutionSequence { get { return _executionSequence; } set { if (_executionSequence == value) return; SetProperty(ref _executionSequence, value); } }
        public String RuleName { get { return _ruleName; } set { if (_ruleName == value) return; SetProperty(ref _ruleName, value); } }
        public String Comparision { get { return _comparision; } set { if (_comparision == value) return; SetProperty(ref _comparision, value); } }
        public String Value { get { return _value; } set { if (_value == value) return; SetProperty(ref _value, value); } }
        public long Catches { get { return _catches; } set { if (_catches == value) return; SetProperty(ref _catches, value); } }
        public String Example { get { return _example; } set { if (_example == value) return; SetProperty(ref _example, value); } }
        public String Description { get { return _description; } set { if (_description == value) return; SetProperty(ref _description, value); } }
        public String Color { get { return _color; } set { if (_color == value) return; SetProperty(ref _color, value); } }

        #endregion
    }
}