using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace QC.CTDS.DM.DataStructures.FormatDescriptorStructure;

[Serializable]
public abstract class ChartOutputGroupDescriptor : GroupSetDescriptor
{
	private ObservableCollection<OuputGraphDisplayProperties> ogDisplayProperties = new ObservableCollection<OuputGraphDisplayProperties>();

	[XmlElement("OGDisplayProperties", Form = XmlSchemaForm.Unqualified)]
	public ObservableCollection<OuputGraphDisplayProperties> OGDisplayProperties
	{
		get
		{
			return ogDisplayProperties;
		}
		set
		{
			if (ogDisplayProperties != value)
			{
				ogDisplayProperties = value;
				OnPropertyChanged("OGDisplayProperties");
			}
		}
	}

	public ChartOutputGroupDescriptor()
	{
		OGDisplayProperties.CollectionChanged += EstablishParentChildRelationOnCollectionChanged;
		OGDisplayProperties.CollectionChanged += OGDisplayProperties_CollectionChanged;
	}

	private void OGDisplayProperties_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
	{
		OnPropertyChanged("OGDisplayProperties");
	}

	public override void Changed(string changedFieldName)
	{
		switch (changedFieldName)
		{
		case "IsChecked":
		case "IsForPPTChecked":
		case "IsExpanded":
		case "IsSelected":
		case "IsPicked":
			if (base.Parent != null)
			{
				base.Parent.Changed(changedFieldName);
			}
			break;
		default:
			base.Changed(changedFieldName);
			break;
		}
	}
}
