using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using QC.CTDS.DM.ApplicationsManager;
using QC.CTDS.DM.DataStructures;

namespace QC.CTDS.DM.AutomationLayer;

[Guid("71EF7342-BA4E-4EB8-B7A9-A5FA3CFB41DB")]
[ComVisible(true)]
[ProgId("DataminerNetAutomationLayer.ReportGeneratorAutomation")]
[ClassInterface(ClassInterfaceType.None)]
public class ReportGeneratorAutomation : IReportGenerator
{
	private ReportGenerator rptGeneratorObject = new ReportGenerator();

	[ComVisible(false)]
	private List<ILogger> loggerList = new List<ILogger>();

	public string ReportEnviornment
	{
		get
		{
			return CreateTempInstance.ReportEnviornment;
		}
		set
		{
			CreateTempInstance.ReportEnviornment = value;
		}
	}

	public string ServicePluginVersion
	{
		get
		{
			return CreateTempInstance.ServicePluginVersion;
		}
		set
		{
			CreateTempInstance.ServicePluginVersion = value;
		}
	}

	[ComVisible(false)]
	public ReportGenerator CreateTempInstance
	{
		get
		{
			if (rptGeneratorObject == null)
			{
				rptGeneratorObject = new ReportGenerator();
			}
			return rptGeneratorObject;
		}
	}

	public ReportSettings ReportSettingsInfo
	{
		get
		{
			return CreateTempInstance.ReportSettingsInfo;
		}
		set
		{
			CreateTempInstance.ReportSettingsInfo = value;
		}
	}

	[ComVisible(false)]
	public List<ILogger> TempLoggerList
	{
		get
		{
			return CreateTempInstance.LoggerList;
		}
		set
		{
			loggerList = value;
		}
	}

	ICollection IReportGenerator.LoggerList
	{
		get
		{
			return TempLoggerList;
		}
		set
		{
			if (value != null)
			{
				TempLoggerList = (List<ILogger>)value;
			}
			else
			{
				TempLoggerList = null;
			}
		}
	}

	public void LoadSourceData(string[] filePaths)
	{
		CreateTempInstance.LoadSourceData(filePaths.ToList());
	}

	public void LoadDescriptor(string filePath)
	{
		CreateTempInstance.LoadDescriptor(filePath);
	}

	public void LoadLimitDescriptor(string limitFilePath)
	{
		CreateTempInstance.LoadLimitDescriptor(limitFilePath);
	}

	public void GenerateReport(string opType, string opFilePath)
	{
		CreateTempInstance.GenerateReport(opType, opFilePath);
	}

	public void SetInputFormat(string inputFormatType)
	{
		CreateTempInstance.SetInputFormat(inputFormatType);
	}

	public void LoadAutoSourceData()
	{
		CreateTempInstance.LoadAutoSourceData();
	}

	public void LoadDescriptor(string[] listOfFiles)
	{
		CreateTempInstance.LoadDescriptor(listOfFiles.ToList());
	}
}
