using Decal.Interop.Filters;

namespace Decal.Adapter.Wrappers;

/// <summary>
/// Defines the WorldObjectCollection filter for objects having the specified name
/// </summary>
public class ByNameFilter : WorldObjectCollectionFilter
{
	private string name;

	/// <summary>
	/// Name of the objects in this collection
	/// </summary>
	public string Name
	{
		get
		{
			return name;
		}
		set
		{
			name = value;
		}
	}

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

	/// <summary>
	/// Creates a new filter using the specified name
	/// </summary>
	/// <param name="name">Name of the object</param>
	public ByNameFilter(string name)
	{
		this.name = name;
	}

	internal override void ApplyFilter(WorldIterator wi)
	{
		wi.ByName(name);
	}

	internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
	{
		ven.ByName(name);
	}
}
