using Decal.Interop.Filters;

namespace Decal.Adapter.Wrappers;

/// <summary>
/// Defines the WorldObjectCollection filter for all objects owned by a character
/// </summary>
public class ByOwnerFilter : WorldObjectCollectionFilter
{
	private int owner;

	/// <summary>
	/// Id of the owner of the objects
	/// </summary>
	public int Owner
	{
		get
		{
			return owner;
		}
		set
		{
			owner = value;
		}
	}

	/// <summary>
	/// Creates a new filter
	/// </summary>
	public ByOwnerFilter()
	{
	}

	/// <summary>
	/// Creates a new filter using the specified owner
	/// </summary>
	/// <param name="owner">Id of the owner</param>
	public ByOwnerFilter(int owner)
	{
		this.owner = owner;
	}

	internal override void ApplyFilter(WorldIterator wi)
	{
		wi.ByOwner(owner);
	}
}
