namespace Gremlin_BlazorServer.Utilities.GUClasses
{
	internal class DataIdType
	{
		private readonly List<string> matchedQualifiers;
		private readonly int numberOfQualifiers;

		public string DataType { get; }
		public List<string> Qualifiers { get; }
		public int Score { get; private set; } = 0;
		public bool AllQualifierMatched { get; private set; } = false;

		public DataIdType(string DataType, IEnumerable<string> Qualifiers)
		{
			this.DataType = DataType;
			this.Qualifiers = Qualifiers.ToList();
			numberOfQualifiers = this.Qualifiers.Count;
			matchedQualifiers = new();
		}

		public void AddFoundQualfier(string QualifierFound)
		{
			matchedQualifiers.Add(QualifierFound);
			Score++;
			AllQualifierMatched = matchedQualifiers.Count == numberOfQualifiers;
		}

		public bool CheckForQualifier(string qualifier) => Qualifiers.Contains(qualifier);

		public void IncreaseScore(int value = 1) => Score += value;

		public void ResetScore() => Score = 0;

		//public override bool Equals(object obj) => obj is DataIdType type && DataType == type.DataType;

		public override int GetHashCode() => HashCode.Combine(DataType);
	}
}
