using System.Text;

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 override string ToString()
    {
        var sb = new StringBuilder();

        if (Annihilate)
            sb.Append("Annihilate ");

        if (Assassinate) 
            sb.Append(nameof(Assassinate) + ' ');

        if (ControlArea)
            sb.Append("ControlArea ");

        if (DestroyHQ)
            sb.Append("DestroyHQ ");

        if (EconomicVictory)
            sb.Append("EconomicVictory ");

        if (GameTimer)
            sb.Append("GameTimer ");

        if (SuddenDeath)
            sb.Append("SuddenDeath ");

        if (TakeAndHold)
            sb.Append("TakeAndHold ");

        return sb.ToString();
    }
}