using System.Runtime.CompilerServices;

namespace Connected;

public enum HorizontalAlignment
{
	Left,
	Right,
	Center,
	Start,
	End
}

public static class HorizontalAlignmentExtensions
{
	public static HorizontalAlignment GetAbsolute(this HorizontalAlignment alignment, bool rightToLeft = false)
	{
		return alignment switch
		{
			HorizontalAlignment.Start => rightToLeft ? HorizontalAlignment.Right : HorizontalAlignment.Left,
			HorizontalAlignment.End => rightToLeft ? HorizontalAlignment.Left : HorizontalAlignment.Right,
			_ => alignment
		};
	}

	public static HorizontalAlignment GetRelative(this HorizontalAlignment alignment, bool rightToLeft = false)
	{
		return alignment switch
		{
			HorizontalAlignment.Left => rightToLeft ? HorizontalAlignment.End : HorizontalAlignment.Start,
			HorizontalAlignment.Right => rightToLeft ? HorizontalAlignment.Start : HorizontalAlignment.End,
			_ => alignment
		};
	}
}
