using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class AfhChannelAssessmentModeInfo
{
	public static AfhChannelAssessmentModeEnum ValueToAfhChannelAssessmentMode(uint value)
	{
		switch (value)
		{
		case 0u:
			return AfhChannelAssessmentModeEnum.Controller_channel_assessment_disabled;
		case 1u:
			return AfhChannelAssessmentModeEnum.Controller_channel_assessment_enabled;
		default:
			if (value >= 2 && value <= 255)
			{
				return AfhChannelAssessmentModeEnum.RESERVED;
			}
			return AfhChannelAssessmentModeEnum.InvalidAfhChannelAssessmentModeValue;
		}
	}

	public static uint AfhChannelAssessmentModeToValue(AfhChannelAssessmentModeEnum enumItem)
	{
		return enumItem switch
		{
			AfhChannelAssessmentModeEnum.Controller_channel_assessment_disabled => 0u, 
			AfhChannelAssessmentModeEnum.Controller_channel_assessment_enabled => 1u, 
			AfhChannelAssessmentModeEnum.RESERVED => 2u, 
			_ => uint.MaxValue, 
		};
	}

	public static string AfhChannelAssessmentModeToString(AfhChannelAssessmentModeEnum enumItem)
	{
		return enumItem switch
		{
			AfhChannelAssessmentModeEnum.Controller_channel_assessment_disabled => "Controller_channel_assessment_disabled", 
			AfhChannelAssessmentModeEnum.Controller_channel_assessment_enabled => "Controller_channel_assessment_enabled", 
			AfhChannelAssessmentModeEnum.RESERVED => "Reserved", 
			_ => "Invalid AfhChannelAssessmentMode Value", 
		};
	}

	public static string AfhChannelAssessmentModeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = Controller_channel_assessment_disabled");
		stringBuilder.AppendLine("0x1 = Controller_channel_assessment_enabled");
		stringBuilder.AppendLine("0x2-0xFF = Reserved");
		return stringBuilder.ToString();
	}
}
