// SPDX-License-Identifier: MIT
// Copyright wtfsckgh@gmail.com
// Copyright iced contributors

namespace Generator.Enums {
	static class PythonUtils {
		public static bool UppercaseEnum(string name) =>
			name switch {
				"Code" or "CpuidFeature" or "EncodingKind" or "Mnemonic" or "Register" or "RflagsBits" or
				"OpCodeOperandKind" or "OpCodeTableKind" or "TupleType" => true,
				_ => false,
			};

		public static (string name, string value) GetEnumNameValue(IdentifierConverter idConverter, EnumValue value, bool uppercaseRawName) {
			var numStr = value.DeclaringType.IsFlags ? NumberFormatter.FormatHexUInt32WithSep(value.Value) : value.Value.ToString();
			string valueName;
			if (uppercaseRawName)
				valueName = value.RawName.ToUpperInvariant();
			else
				valueName = value.Name(idConverter);
			return (valueName, numStr);
		}
	}
}
