namespace EDPlayerJournal; 

/// <summary>
/// Static strings related to combat zones
/// </summary>
public class CombatZones {
    /// <summary>
    /// Type string for ground combat zone
    /// </summary>
    public static readonly string GroundCombatZone = "Ground";

    /// <summary>
    /// Type string for ship combat zones
    /// </summary>
    public static readonly string ShipCombatZone = "Ship";

    /// <summary>
    /// AX combat zone
    /// </summary>
    public static readonly string AXCombatZone = "AX";

    /// <summary>
    /// Difficulty low
    /// </summary>
    public static readonly string DifficultyLow = "Low";

    /// <summary>
    /// Difficulty medium
    /// </summary>
    public static readonly string DifficultyMedium = "Medium";

    /// <summary>
    /// Difficulty high
    /// </summary>
    public static readonly string DifficultyHigh = "High";

    /// <summary>
    /// Very high difficulty, so far AX combat zone only
    /// </summary>
    public static readonly string DifficultyVeryHigh = "Very High";

    /// <summary>
    /// Returns the given combat zone difficulty as an integer, so it can be sorted.
    /// 0 = lowest difficulty, 1 = medium and so forth.
    /// </summary>
    public static int? DifficultyRank(string? difficulty) {
        Dictionary<string, int> ranks = new() {
            { DifficultyLow, 0 },
            { DifficultyMedium, 1 },
            { DifficultyHigh, 2 },
            { DifficultyVeryHigh, 3 }
        };

        if (difficulty == null ) {
            return null;
        }

        if (ranks.TryGetValue(difficulty, out int rank)) {
            return rank;
        }

        return null;
    }
}
