using System.Globalization;

namespace Decal.Filters;

public class SkillType
{
	private static SkillType[] sTypes = new SkillType[3]
	{
		new SkillType(1, "Combat"),
		new SkillType(2, "Other"),
		new SkillType(3, "Magic")
	};

	private int mId;

	private string mName;

	public int Id => mId;

	public string Name => mName;

	public static SkillType GetById(int id)
	{
		for (int i = 0; i < sTypes.Length; i++)
		{
			if (sTypes[i].Id == id)
			{
				return sTypes[i];
			}
		}
		return null;
	}

	public static SkillType GetByName(string name)
	{
		for (int i = 0; i < sTypes.Length; i++)
		{
			if (string.Compare(sTypes[i].Name, name, ignoreCase: true, CultureInfo.InvariantCulture) == 0)
			{
				return sTypes[i];
			}
		}
		return null;
	}

	private SkillType(int id, string name)
	{
		mId = id;
		mName = name;
	}

	public override string ToString()
	{
		return mName;
	}
}
