using DbController;
using Tabletop.Core.Models.Abstract;

namespace Tabletop.Core.Models
{
    public class Player : ArmyBase
    {
        [CompareField("player_id")]
        public int PlayerId { get; set; }
        [CompareField("user_id")]
        public int UserId { get; set; }
        [CompareField("game_id")]
        public int GameId { get; set; }
        [CompareField("team")]
        public int Team { get; set; }
        [CompareField("color")]
        public string Color { get; set; } = string.Empty;
        [CompareField("points")]
        public int Points { get; set; }
        [CompareField("order_nr")]
        public int OrderNr { get; set; }
        [CompareField("start_zone")]
        public int StartZone { get; set; }
        [CompareField("number_of_eliminations")]
        public int NumberOfEliminations { get; set; }
        [CompareField("force_points_of_eliminations")]
        public int ForcePointsOfEliminations { get; set; }
        [CompareField("number_of_remaining_units")]
        public int NumberOfRemainingUnits { get; set; }
        [CompareField("own_force_points_left")]
        public int OwnForcePointsLeft { get; set; }


        public int AllowedForce {  get; set; }
        public User User { get; set; } = new();

        public string ConnectionId { get; set; } = string.Empty; // Verbindung zu SignalR
        public bool IsReady { get; set; }

        public override Dictionary<string, object?> GetParameters()
        {
            var baseParams = base.GetParameters();

            baseParams["PLAYER_ID"] = PlayerId;
            baseParams["USER_ID"] = UserId;
            baseParams["GAME_ID"] = GameId;
            baseParams["TEAM"] = Team;
            baseParams["COLOR"] = Color;
            baseParams["ORDER_NR"] = OrderNr;
            baseParams["START_ZONE"] = StartZone;
            baseParams["NUMBER_OF_ELIMINATIONS"] = NumberOfEliminations;
            baseParams["FORCE_POINTS_OF_ELIMINATIONS"] = ForcePointsOfEliminations;
            baseParams["NUMBER_OF_REMAINING_UNITS"] = NumberOfRemainingUnits;
            baseParams["OWN_FORCE_POINTS_LEFT"] = OwnForcePointsLeft;
            return baseParams;
        }
    }
}