using System.Collections.Generic;

namespace QCRPG.TSL.BT;

public class LECisInfo
{
	public struct LECisData
	{
		public uint icoChannelID;

		public uint cisHandle;
	}

	public List<LECisData> leCisInfoList = new List<LECisData>();

	public int pendingCisId;

	public LECisInfo()
	{
		leCisInfoList.Clear();
		pendingCisId = -1;
	}

	public uint LeGetIcoHandlePerIcoChannelId(uint chId)
	{
		foreach (LECisData leCisInfo in leCisInfoList)
		{
			if (leCisInfo.icoChannelID == chId)
			{
				return leCisInfo.cisHandle;
			}
		}
		return 0u;
	}

	public int LeGetCisChannelIdPerCisHandle(uint icoHandle)
	{
		foreach (LECisData leCisInfo in leCisInfoList)
		{
			if (leCisInfo.cisHandle == icoHandle)
			{
				return (int)leCisInfo.icoChannelID;
			}
		}
		return -1;
	}

	public void LeIcoRemoveItemPerIcoHandle(uint icoHandle)
	{
		int num = LeGetCisChannelIdPerCisHandle(icoHandle);
		if (num != -1)
		{
			LECisData item = default(LECisData);
			item.icoChannelID = (uint)num;
			item.cisHandle = icoHandle;
			leCisInfoList.Remove(item);
		}
	}
}
