using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;

namespace Damage_Calculator.Models
{
    public class CsgoMap
    {
        /// <summary>
        /// The types of maps.
        /// </summary>
        public enum eMapType { Undefined, Defusal, Hostage, DangerZone, ArmsRace }

        /// <summary>
        /// The actual radar image of the map.
        /// </summary>
        public BitmapSource MapImage { get; set; }

        /// <summary>
        /// The type of gamemode that's played on this map by default.
        /// </summary>
        public eMapType MapType { get; set; }

        /// <summary>
        /// The absolute path to the DDS map radar file.
        /// </summary>
        public string MapImagePath { get; set; }

        /// <summary>
        /// The absolute path to the actual BSP map file.
        /// </summary>
        public string BspFilePath { get; set; }

        /// <summary>
        /// The absolute path to the file that holds this map's navigation meshes and callouts.
        /// This might not always be existent, because it is generated by the map builder.
        /// It is always created with maps that are in the main game, because they need callouts and bot movements.
        /// </summary>
        public string NavFilePath { get; set; }

        /// <summary>
        /// The map name as given in the file name, but without the prefix.
        /// </summary>
        public string MapFileName { get; set; }

        /// <summary>
        /// The multiplier that is stored in the text file with each map.
        /// The pixels will get multiplied with this multiplier to get in-game units.
        /// </summary>
        public float MapSizeMultiplier { get; set; }

        /// <summary>
        /// The X coordinate that is in the upper left hand corner of the radar.
        /// This is used to position some things according to their coordinates, such as player spawns and nav meshes.
        /// </summary>
        public float UpperLeftWorldXCoordinate { get; set; } = -1;

        /// <summary>
        /// The Y coordinate that is in the upper left hand corner of the radar.
        /// This is used to position some things according to their coordinates, such as player spawns and nav meshes.
        /// </summary>
        public float UpperLeftWorldYCoordinate { get; set; } = -1;

        /// <summary>
        /// The X position of the CT spawn icon on the map (used in the loading screen).
        /// Floating point, 0 is left and 1 is right.
        /// </summary>
        public float CTSpawnMultiplierX { get; set; } = -1;

        /// <summary>
        /// The Y position of the CT spawn icon on the map (used in the loading screen).
        /// Floating point, 0 is top and 1 is bottom.
        /// </summary>
        public float CTSpawnMultiplierY { get; set; } = -1;

        /// <summary>
        /// The X position of the T spawn icon on the map (used in the loading screen).
        /// Floating point, 0 is left and 1 is right.
        /// </summary>
        public float TSpawnMultiplierX { get; set; } = -1;

        /// <summary>
        /// The Y position of the T spawn icon on the map (used in the loading screen).
        /// Floating point, 0 is top and 1 is bottom.
        /// </summary>
        public float TSpawnMultiplierY { get; set; } = -1;

        /// <summary>
        /// The X position of the bomb site A icon on the map (used in the loading screen).
        /// Floating point, 0 is left and 1 is right.
        /// </summary>
        public float BombAX { get; set; } = -1;

        /// <summary>
        /// The Y position of the bomb site A icon on the map (used in the loading screen).
        /// Floating point, 0 is top and 1 is bottom.
        /// </summary>
        public float BombAY { get; set; } = -1;

        /// <summary>
        /// The X position of the bomb site B icon on the map (used in the loading screen).
        /// Floating point, 0 is left and 1 is right.
        /// </summary>
        public float BombBX { get; set; } = -1;

        /// <summary>
        /// The Y position of the bomb site B icon on the map (used in the loading screen).
        /// Floating point, 0 is top and 1 is bottom.
        /// </summary>
        public float BombBY { get; set; } = -1;

        /// <summary>
        /// The bomb damage in this map. By default it's 500.
        /// </summary>
        public float BombDamage { get; set; } = 500;

        /// <summary>
        /// Raw list of entities in this map, as stored in the BSP file.
        /// </summary>
        public string EntityList { get; set; }

        public int AmountPrioritySpawnsCT { get; set; }

        public int AmountSpawnsCT { get; set; }

        public int AmountPrioritySpawnsT { get; set; }

        public int AmountSpawnsT { get; set; }

        public int AmountHostages { get; set; }

        public bool HasPrioritySpawnsT
        {
            get
            {
                return this.AmountPrioritySpawnsT < this.AmountSpawnsT;
            }
        }

        public bool HasPrioritySpawnsCT
        {
            get
            {
                return this.AmountPrioritySpawnsCT < this.AmountSpawnsCT;
            }
        }

        public List<PlayerSpawn> SpawnPoints { get; set; } = new List<PlayerSpawn>();
    }
}
