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

namespace Decal.Adapter.Wrappers;

[CLSCompliant(true)]
public class AllegianceInfoWrapper : MarshalByRefObject, IDisposable
{
	private AllegianceInfo myAllegianceInfo;

	private bool isDisposed;

	public int Id => myAllegianceInfo.GUID;

	public int Gender => myAllegianceInfo.Gender;

	public int Leadership => myAllegianceInfo.Leadership;

	public int Loyalty => myAllegianceInfo.Loyalty;

	public string Name => myAllegianceInfo.Name;

	public int Race => myAllegianceInfo.Race;

	public int Rank => myAllegianceInfo.Rank;

	public int ParentId => myAllegianceInfo.TreeParent;

	public int Type => myAllegianceInfo.Type;

	public double Unknown => myAllegianceInfo.Unknown;

	public long XP => myAllegianceInfo.XP_64;

	internal AllegianceInfoWrapper(AllegianceInfo info)
	{
		myAllegianceInfo = info;
	}

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

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

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

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