using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace QC.CTDS.DM.DataStructures.FormatDescriptorStructure;

[Serializable]
[DataContract]
public class OuputGraphDisplayProperties : BindableObject
{
	private int _legendPosition = 4;

	private ObservableCollection<Axis> xAxis = new ObservableCollection<Axis>();

	private ObservableCollection<Axis> yAxis = new ObservableCollection<Axis>();

	[DefaultValue(4)]
	[XmlAttribute]
	[DataMember]
	public int legendPosition
	{
		get
		{
			return _legendPosition;
		}
		set
		{
			if (_legendPosition != value)
			{
				_legendPosition = value;
				OnPropertyChanged("legendPosition");
			}
		}
	}

	[XmlIgnore]
	public IDictionary LegendPositions
	{
		get
		{
			IDictionary dictionary = new Dictionary<int, string>();
			dictionary.Add(4, "TOP");
			dictionary.Add(3, "LEFT");
			dictionary.Add(2, "BOTTOM");
			dictionary.Add(1, "RIGHT");
			dictionary.Add(0, "OFF");
			return dictionary;
		}
	}

	[XmlElement("XAxis", Form = XmlSchemaForm.Unqualified)]
	[DataMember]
	public ObservableCollection<Axis> XAxis
	{
		get
		{
			return xAxis;
		}
		set
		{
			if (xAxis != value)
			{
				xAxis = value;
				OnPropertyChanged("XAxis");
			}
		}
	}

	[XmlElement("YAxis", Form = XmlSchemaForm.Unqualified)]
	[DataMember]
	public ObservableCollection<Axis> YAxis
	{
		get
		{
			return yAxis;
		}
		set
		{
			if (yAxis != value)
			{
				yAxis = value;
				OnPropertyChanged("YAxis");
			}
		}
	}

	public OuputGraphDisplayProperties()
	{
		XAxis.CollectionChanged += EstablishParentChildRelationOnCollectionChanged;
		XAxis.CollectionChanged += XAxis_CollectionChanged;
		YAxis.CollectionChanged += EstablishParentChildRelationOnCollectionChanged;
		YAxis.CollectionChanged += YAxis_CollectionChanged;
	}

	private void XAxis_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
	{
		OnPropertyChanged("XAxis");
	}

	private void YAxis_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
	{
		OnPropertyChanged("YAxis");
	}
}
