using System;
using System.Globalization;

namespace Decal.Adapter.Wrappers;

/// <summary>
/// Support class for HooksWrapper
/// This class 
/// </summary>
public sealed class HookIndexer<IndexType> : MarshalByRefObject where IndexType : struct, IConvertible
{
	private hookIndexType myIndex;

	private IIndexedValueProvider myWrap;

	public int this[IndexType item] => myWrap.GetIndexedObject(myIndex, item.ToInt32(CultureInfo.InvariantCulture));

	internal HookIndexer(IIndexedValueProvider wrap, hookIndexType index)
	{
		myIndex = index;
		myWrap = wrap;
	}
}
