using ActionGame.GameResources.Models;
using System;
using System.Collections.Generic;


namespace GameMaker.Models
{
    public class WorldCellDefinition
    {
        public Int32 WorldX { get; set; }
        public Int32 WorldY { get; set; }
        public Int32 SongKey { get; set; }
        public Dictionary<Int32, Dictionary<Int32, Int32?>> TilesLayer1 { get; }
        public Dictionary<Int32, Dictionary<Int32, Int32?>> TilesLayer2 { get; }
        public IList<DoorDefinition> Doors { get; }
        public IList<NonPlayerCharacterDefinition> NPCs { get; }
        public IList<EnemyDefinitionPlacement> EnemyDefinitionPlacements { get; }


        public WorldCellDefinition()
        {
            this.TilesLayer1 = new Dictionary<Int32, Dictionary<Int32, Int32?>>();
            this.TilesLayer2 = new Dictionary<Int32, Dictionary<Int32, Int32?>>();
            this.Doors = new List<DoorDefinition>();
            this.NPCs = new List<NonPlayerCharacterDefinition>();
            this.EnemyDefinitionPlacements = new List<EnemyDefinitionPlacement>();
        }


        public void AddTile(Int32 x, Int32 y, Int32? tile1, Int32? tile2)
        {
            if (TilesLayer1.ContainsKey(x) == false) TilesLayer1.Add(x, new Dictionary<Int32, Int32?>());
            if (TilesLayer2.ContainsKey(x) == false) TilesLayer2.Add(x, new Dictionary<Int32, Int32?>());

            TilesLayer1[x].Add(y, tile1);
            TilesLayer2[x].Add(y, tile2);
        }


        public void Initialize()
        {

            for(Int32 x = 0; x < 22; x++)
            {
                for(Int32 y = 0; y < 11; y++)
                {
                    this.AddTile(x, y, null, null);
                }
            }

        }



    }
}
