using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace QC.SmartMatchApp;

[Serializable]
public class KitValues
{
	private List<double> capacitorValues;

	public string RefDesignator { get; set; }

	public List<double> CapacitorValues
	{
		get
		{
			return capacitorValues;
		}
		set
		{
			capacitorValues = value;
		}
	}

	public List<double> InductorValues { get; set; }

	public KitValues()
	{
		RefDesignator = "";
		CapacitorValues = new List<double>();
		InductorValues = new List<double>();
	}

	public void SaveToFiles(string folder)
	{
		string text = folder + "\\";
		if (!string.IsNullOrWhiteSpace(RefDesignator))
		{
			text = text + RefDesignator + "_";
		}
		text += "KitValues_";
		string path = text + "capacitors.csv";
		string path2 = text + "inductors.csv";
		if (CapacitorValues.Count > 0)
		{
			File.WriteAllText(path, string.Join(",", CapacitorValues.Distinct().ToArray()));
		}
		if (InductorValues.Count > 0)
		{
			File.WriteAllText(path2, string.Join(",", InductorValues.Distinct().ToArray()));
		}
	}
}
