using System;
using QCRPG.Framework;
using QCRPG.TSL.FM.Packets;

namespace QCRPG.TSL.FM;

public class FMBuilder : BuilderBase
{
	private PacketListBase packetListForGooier = new FMPacketList();

	public override void BuildTSL(PacketReceiveMode packetReceiveMode, bool deviceEmulationMode = false, int dutNumber = 1, bool commandLineMode = false, bool automationMode = false)
	{
		if (deviceEmulationMode)
		{
			throw new Exception("Device emulation mode not supported");
		}
		name = "FM I2C";
		dutName = "DUT" + dutNumber;
		logger = new Logger(name, dutName);
		if (commandLineMode)
		{
			packetList = new FMPacketList();
			api = new FMAPI(packetList, logger, packetReceiveMode);
			return;
		}
		configurer = new Configurer();
		packetList = new FMPacketList();
		api = new FMAPI(packetList, logger, packetReceiveMode);
		gooier = new FMGooier(name, logger, configurer, (FMAPI)api, packetListForGooier);
		scripter = new FMScripter((FMAPI)api);
	}
}
