using System.Reflection;
using System.Web.Http;
using Interfaces;

namespace WindowsDataCenter
{
    [RoutePrefix("api/app")]
    public class ApplicationController:ApiController
    {
        [Route("")]
        public IHttpActionResult GetAppDetails()
        {
            var ninjectHelper = NinjectHelper.GetInstance();
            var appDetails = new AppDetails
            {
                ApplicationName = "Flexitime Tracker",
                DataBaseProvider = ninjectHelper.Get<IRepository>().GetType().ToString(),
                LoggerProvider = ninjectHelper.Get<ILogger>().GetType().ToString(),
                Version = Assembly.GetEntryAssembly().GetName().Version.ToString(),
                ErrorEmailAddress = ConfigurationHandler.ConfigurationHandler.GetConfiguration("BugSubmissionEmailAddress") ?? "NONE"
            };

            return Ok(appDetails);
        }
    }
}
