using System.Collections;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using EVE.EVEObjects;

namespace EVE.EVEAssets
{
    public class EVEModelManager
    {
        private static Model defaultModel;
        private static string defaultModelPath = @"Content/Models/tiger";

        private static Dictionary<string, string> myModelsPaths = new Dictionary<string, string>();
        private static Dictionary<string, Model> myModels = new Dictionary<string, Model>();

        public static void AddModel(string modelLabel, string assetPath)
        {
            if (!myModels.ContainsKey(modelLabel))
            {
                myModelsPaths.Add(modelLabel,assetPath);
            }
        }

        internal static void LoadContent(GraphicsDevice myDevice, ContentManager myLoader)
        {
            defaultModel = myLoader.Load<Model>(defaultModelPath);

            foreach (KeyValuePair<string,string> LabelPath in myModelsPaths)
            {
                Model newModel = myLoader.Load<Model>(LabelPath.Value);
                myModels.Add(LabelPath.Key, newModel);
            }
        }

        internal static Model GetModelAsset(string modelLabel)
        {

            if (modelLabel != null && myModels.ContainsKey(modelLabel))
                return myModels[modelLabel] as Model;
            return defaultModel;

        }
    }
}