namespace SoulstormReplayReader.Core.Domain;

public sealed class WinConditions
{
    public enum ConditionValues
    {
        Annihilate = 1003066394,
        SuddenDeath = -1826760460,
        Assassinate = 200405640,
        EconomicVictory = -242444938,
        ControlArea = 735076042,
        DestroyHQ = 1509920563,
        TakeAndHold = 1959084950,
        GameTimer = 69421273
    }

    // [DWORD] [WIN_CONDITION]
    // 767227721 Annihilate
    // -1826760460 SuddenDeath
    // 200405640 Assassinate
    // -242444938 EconomicVictory
    // 735076042 ControlArea
    // 1509920563 DestroyHQ
    // 1959084950 TakeAndHold
    // 69421273 GameTime

    public bool TakeAndHold { get; set; }

    public bool DestroyHQ { get; set; }

    public bool ControlArea { get; set; }

    public bool EconomicVictory { get; set; }

    public bool SuddenDeath { get; set; }

    public bool Annihilate { get; set; }

    public bool Assassinate { get; set; }

    public bool GameTimer { get; set; }

    public IEnumerable<string> Enumerate()
    {
        if (Annihilate)
            yield return nameof(Annihilate);
        if (Assassinate)
            yield return nameof(Assassinate);
        if (ControlArea)
            yield return nameof(ControlArea);
        if (DestroyHQ)
            yield return nameof(DestroyHQ);
        if (EconomicVictory)
            yield return nameof(EconomicVictory);
        if (GameTimer)
            yield return nameof(GameTimer);
        if (SuddenDeath)
            yield return nameof(SuddenDeath);
        if (TakeAndHold)
            yield return nameof(TakeAndHold);
    }

    public override string ToString() => string.Join('\n', Enumerate());
}