using System;
using System.Runtime.InteropServices;
using Decal.Interop.Filters;

namespace Decal.Adapter.Wrappers;

[CLSCompliant(true)]
public class AttributeInfoWrapper : MarshalByRefObject, IDisposable
{
	private AttributeInfo myAttribInfo;

	private bool isDisposed;

	public int Base => myAttribInfo.Base;

	public int Buffed => myAttribInfo.Buffed;

	public int Creation => myAttribInfo.Creation;

	public int Exp => myAttribInfo.Exp;

	public string Name => myAttribInfo.Name;

	internal AttributeInfoWrapper(AttributeInfo info)
	{
		myAttribInfo = info;
	}

	~AttributeInfoWrapper()
	{
		Dispose(disposing: false);
	}

	public void Dispose()
	{
		Dispose(disposing: true);
		GC.SuppressFinalize(this);
	}

	protected virtual void Dispose(bool disposing)
	{
		if (!isDisposed)
		{
		}
		if (myAttribInfo != null)
		{
			Marshal.ReleaseComObject(myAttribInfo);
		}
		isDisposed = true;
	}

	protected void EnforceDisposedOnce()
	{
		if (isDisposed)
		{
			throw new ObjectDisposedException("AttributeInfoWrapper");
		}
	}
}
