using System.Globalization;

namespace Decal.Filters;

public class SkillState
{
	private static SkillState[] sStates = new SkillState[3]
	{
		new SkillState(1, "Untrained"),
		new SkillState(2, "Trained"),
		new SkillState(3, "Specialized")
	};

	private int mId;

	private string mName;

	public int Id => mId;

	public string Name => mName;

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

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

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

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