using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;
using QC.CTDS.DM.SharedLibrary;

namespace QC.CTDS.DM.DataStructures.FormatDescriptorStructure;

[Serializable]
public abstract class GroupSetDescriptor : DiscriminatorElement, IDataErrorInfo
{
	protected string _Name;

	protected string _Description;

	protected bool isSelected;

	protected bool isExpanded;

	protected bool? isChecked = true;

	protected bool? isForPPTChecked = true;

	protected bool pptMode;

	private bool _sort;

	[XmlAttribute(AttributeName = "name")]
	public string Name
	{
		get
		{
			return _Name;
		}
		set
		{
			if (!(_Name == value))
			{
				_Name = value;
				OnPropertyChanged("Name");
			}
		}
	}

	public string Description
	{
		get
		{
			return _Description;
		}
		set
		{
			if (!(_Description == value))
			{
				_Description = value;
				OnPropertyChanged("Description");
			}
		}
	}

	[XmlIgnore]
	public bool IsSelected
	{
		get
		{
			return isSelected;
		}
		set
		{
			if (isSelected != value)
			{
				isSelected = value;
				OnPropertyChanged("IsSelected");
			}
		}
	}

	[XmlIgnore]
	public bool IsExpanded
	{
		get
		{
			return isExpanded;
		}
		set
		{
			if (isExpanded != value)
			{
				isExpanded = value;
				OnPropertyChanged("IsExpanded");
			}
		}
	}

	[XmlIgnore]
	public virtual bool? IsChecked
	{
		get
		{
			return isChecked;
		}
		set
		{
			if (isChecked != value)
			{
				isChecked = value;
				OnPropertyChanged("IsChecked");
			}
		}
	}

	[XmlAttribute(AttributeName = "IsChecked")]
	public string IsCheckedString
	{
		get
		{
			if (isChecked.HasValue)
			{
				return isChecked.Value.ToString();
			}
			return Constants.IndeterminateState;
		}
		set
		{
			bool result = false;
			if (bool.TryParse(value, out result))
			{
				isChecked = result;
			}
			else if (value.ToLower() == Constants.IndeterminateState)
			{
				isChecked = null;
			}
		}
	}

	[XmlIgnore]
	public virtual bool? IsForPPTChecked
	{
		get
		{
			return isForPPTChecked;
		}
		set
		{
			if (isForPPTChecked != value)
			{
				isForPPTChecked = value;
				OnPropertyChanged("IsForPPTChecked");
			}
		}
	}

	[XmlAttribute(AttributeName = "IsForPPTChecked")]
	public string IsForPPTCheckedString
	{
		get
		{
			if (isForPPTChecked.HasValue)
			{
				return isForPPTChecked.Value.ToString();
			}
			return Constants.IndeterminateState;
		}
		set
		{
			bool result = false;
			if (bool.TryParse(value, out result))
			{
				isForPPTChecked = result;
			}
			else if (value.ToLower() == Constants.IndeterminateState)
			{
				isForPPTChecked = null;
			}
		}
	}

	[XmlIgnore]
	public virtual bool PPTMode
	{
		get
		{
			return pptMode;
		}
		set
		{
			if (pptMode != value)
			{
				pptMode = value;
				OnPropertyChanged("PPTMode");
			}
		}
	}

	public string Error
	{
		get
		{
			throw new NotImplementedException();
		}
	}

	public virtual string this[string columnName] => string.Empty;

	[XmlAttribute]
	[DefaultValue(false)]
	public bool sort
	{
		get
		{
			return _sort;
		}
		set
		{
			if (_sort != value)
			{
				_sort = value;
				base.OnPropertyChanged("sort");
			}
		}
	}

	public GroupSetDescriptor()
	{
	}

	public abstract List<string> GetTestNames();

	internal abstract void ApplyFileGrouping(IEnumerable<string> groupNames);

	internal abstract void RemoveFileGrouping(IEnumerable<string> groupNames);

	internal abstract void ApplyGroupPrefix(Discriminator discriminator);

	public abstract IEnumerable<ResultDataSet> GetResultSets();
}
