namespace Theriapolis.Core.Rules.Combat;

/// <summary>
/// Phase 6.5 M3 — pheromone compounds a Scent-Broker can deploy via
/// Pheromone Craft. Each maps to a <see cref="Theriapolis.Core.Rules.Stats.Condition"/>
/// applied to creatures in the radius that fail their CON save.
///
/// The four compounds match <c>theriapolis-rpg-equipment.md</c>'s pheromone
/// vials, but here they're emitted directly via the class feature without
/// the consumable.
/// </summary>
public enum PheromoneType : byte
{
    /// <summary>Failed save → <see cref="Theriapolis.Core.Rules.Stats.Condition.Frightened"/>.</summary>
    Fear   = 0,
    /// <summary>Failed save → <see cref="Theriapolis.Core.Rules.Stats.Condition.Charmed"/> (won't attack source).</summary>
    Calm   = 1,
    /// <summary>Failed save → <see cref="Theriapolis.Core.Rules.Stats.Condition.Dazed"/> (loss of focus).</summary>
    Arousal = 2,
    /// <summary>Failed save → <see cref="Theriapolis.Core.Rules.Stats.Condition.Poisoned"/> (debuff).</summary>
    Nausea  = 3,
}

public static class PheromoneTypeExtensions
{
    /// <summary>Maps a <see cref="PheromoneType"/> to the condition it applies on a failed save.</summary>
    public static Theriapolis.Core.Rules.Stats.Condition AppliedCondition(this PheromoneType t) => t switch
    {
        PheromoneType.Fear    => Theriapolis.Core.Rules.Stats.Condition.Frightened,
        PheromoneType.Calm    => Theriapolis.Core.Rules.Stats.Condition.Charmed,
        PheromoneType.Arousal => Theriapolis.Core.Rules.Stats.Condition.Dazed,
        PheromoneType.Nausea  => Theriapolis.Core.Rules.Stats.Condition.Poisoned,
        _                      => Theriapolis.Core.Rules.Stats.Condition.None,
    };

    /// <summary>Human-readable display name for combat log entries.</summary>
    public static string DisplayName(this PheromoneType t) => t switch
    {
        PheromoneType.Fear    => "Fear",
        PheromoneType.Calm    => "Calm",
        PheromoneType.Arousal => "Arousal",
        PheromoneType.Nausea  => "Nausea",
        _                      => "Unknown",
    };
}
