using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;

namespace QC.SmartMatchApp;

[Serializable]
public class SmartMatchConfig
{
	private TrialData trialData;

	private UserScenarioData scenarioData;

	private List<TrialData> bandClassTrials;

	private List<KitValues> customKitValues;

	public TrialData TrialData
	{
		get
		{
			return trialData;
		}
		set
		{
			trialData = value;
		}
	}

	public List<TrialData> BandClassTrials
	{
		get
		{
			return bandClassTrials;
		}
		set
		{
			bandClassTrials = value;
		}
	}

	public UserScenarioData ScenarioData
	{
		get
		{
			return scenarioData;
		}
		set
		{
			scenarioData = value;
		}
	}

	public List<KitValues> CustomKitValues
	{
		get
		{
			return customKitValues;
		}
		set
		{
			customKitValues = value;
		}
	}

	public void SaveData(string fileName)
	{
		XmlSerializer xmlSerializer = new XmlSerializer(typeof(SmartMatchConfig));
		TextWriter textWriter = new StreamWriter(fileName);
		xmlSerializer.Serialize(textWriter, this);
		textWriter.Close();
	}

	public void LoadData(string fileName)
	{
		SmartMatchConfig smartMatchConfig = new SmartMatchConfig();
		FileStream fileStream = null;
		XmlSerializer xmlSerializer = new XmlSerializer(typeof(SmartMatchConfig));
		fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
		if (fileStream != null)
		{
			smartMatchConfig = (SmartMatchConfig)xmlSerializer.Deserialize(fileStream);
			TrialData = smartMatchConfig.TrialData;
			BandClassTrials = smartMatchConfig.BandClassTrials;
			CustomKitValues = smartMatchConfig.CustomKitValues;
			ScenarioData = smartMatchConfig.ScenarioData;
			fileStream.Close();
		}
	}
}
