namespace Assets.Scripts.Utils
{
    public enum TileType
    {
        Default,
        Wall,
        Background
    }

    public class Map
    {
        #region Fields

        public uint Columns { get; set; }
        public uint Rows { get; set; }

        private TileType[,] _map;

        #endregion

        #region Ctors

        public Map(uint cols, uint rows)
        {
            Columns = cols;
            Rows = rows;

            _map = new TileType[Columns, Rows];

            for (int x = 0; x < _map.GetLength(0); x++)
            {
                for (int y = 0; y < _map.GetLength(1); y++)
                {
                    _map[x, y] = TileType.Default;
                }
            }
        }

        #endregion

        public TileType this[uint x, uint y]
        {
            get { return _map[x, y]; }
            set { _map[x, y] = value; }
        }

        public override string ToString()
        {
            string ret = "";

            for (int y = 0; y < Rows; y++)
            {
                for (int x = 0; x < Columns; x++)
                {
                    ret += _map[x, y] + " ";
                }
                ret += "\n";
            }

            return ret;
        }
    }
}