using System.Web.Mvc;
using System.Web.Routing;
using SmartStore.Web.Framework.Localization;
using SmartStore.Web.Framework.Mvc.Routes;
using SmartStore.Web.Framework.Seo;

namespace SmartStore.Web.Infrastructure
{
    public partial class SeoRoutes : IRouteProvider
    {
        public void RegisterRoutes(RouteCollection routes)
        {
            //generic URLs
            routes.MapGenericPathRoute("GenericUrl",
                "{generic_se_name}",
                new { controller = "Common", action = "GenericUrl" },
                new[] { "SmartStore.Web.Controllers" });

            routes.MapLocalizedRoute("Product",
                "{SeName}",
                new { controller = "Product", action = "Product" },
                new[] { "SmartStore.Web.Controllers" });
            routes.MapLocalizedRoute("Category",
                "{SeName}",
                new { controller = "Catalog", action = "Category" },
                new[] { "SmartStore.Web.Controllers" });
            routes.MapLocalizedRoute("Manufacturer",
                "{SeName}",
                new { controller = "Catalog", action = "Manufacturer" },
                new[] { "SmartStore.Web.Controllers" });
            routes.MapLocalizedRoute("NewsItem",
	            "{SeName}",
	            new { controller = "News", action = "NewsItem" },
	            new[] { "SmartStore.Web.Controllers" });
            routes.MapLocalizedRoute("BlogPost",
                "{SeName}",
                new { controller = "Blog", action = "BlogPost" },
                new[] { "SmartStore.Web.Controllers" });

			routes.MapLocalizedRoute("PageNotFound",
				"{*path}",
				new { controller = "Error", action = "NotFound" },
				new[] { "SmartStore.Web.Controllers" });
        }

        public int Priority
        {
            get
            {
                return int.MinValue;
            }
        }
    }
}
