using SoulstormReplayReader.Core.Domain.Action;
using SoulstormReplayReader.Core.Domain.ChatMessage;
using SoulstormReplayReader.Core.Domain.Player;
using SoulstormReplayReader.Core.Enums;

namespace SoulstormReplayReader.Core.Domain.Replay;

public sealed class ReplayModel
{
    public ReplayVersion Version { get; set; }

    public string IngameName { get; set; }
    public string ModName { get; set; }
    public string EngineName { get; set; }
    public string EngineAddon { get; set; } // Не очень понятно что это

    public uint WorldSeed { get; set; }
    public int TotalTicks { get; set; }

    public Map Map { get; } = new();

    public List<PlayerModel> Players { get; set; }
    public List<IGameAction> Actions { get; set; }
    public List<ChatMessageModel> ChatMessages { get; set; }

    public GameSettings GameSettings { get; } = new();
    public WinConditions WinConditions { get; } = new();

    public Exception Exception { get; set; }

    public IEnumerable<PlayerModel> ActivePlayers => Players.Where(x => x.IsActive);
    public int ActivePlayersCount => Players.Count(p => p.IsActive);
    public int TeamsCount => Players.Select(player => player.Team).Max();
}