using System.Reflection;

namespace zotanpw_web;

public static class Utils {
	public static readonly string Version =
		((AssemblyInformationalVersionAttribute)Assembly.GetEntryAssembly()!.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false)[0])
		.InformationalVersion[6..];

	public static readonly string LinkVersion = Version[..8];

	// Works up to 79, doubt i'll have >=80 minute read time blog posts
	public static string a_an(int number) {
		if (number >= 80)
			throw new ArgumentOutOfRangeException();

		return number switch {
			8  => "an",
			11 => "an",
			18 => "an",
			_  => "a"
		};
	}
}