using System.Web.Http;
using System.Web.Mvc;

namespace Qusion.WebApp.Areas
{
    public class QusionAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get { return "Qusion"; }
        }
       
        public override void RegisterArea(AreaRegistrationContext context)
        {
            var config = GlobalConfiguration.Configuration;

            config.Routes.MapHttpRoute(
                name: "QusionApi",
                routeTemplate: "qusion/api/{controller}/{action}/{id}",
                defaults: new {id = RouteParameter.Optional}
                );

            // Register Qusion default route
            context.MapRoute(
                "Qusion_default",
                "Qusion/{controller}/{action}/{id}",
                new {controller="Home", action = "Index", id = UrlParameter.Optional},
                // todo: this is going to make troubles in case of same name controllers
                new[] { "Qusion.WebApp.Areas.Qusion.Controllers", "Qusion.WebApp.Controllers" }
                );
        }
    }
}