using System.Web.Mvc;
using System.Web.Routing;

namespace Sevomin.WebFrontend
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "404",
                url: "404",
                defaults: new { controller = "Base", action = "Error404" }
            );

            #region For Downloads
            routes.MapRoute(
                name: "EnglishResumeGrabber",
                url: "dovomin/resume/english/{userid}",
                defaults: new { controller = "Authorized", action = "GetResume", english = true, userid = UrlParameter.Optional }
            );
            routes.MapRoute(
                name: "PersianResumeGrabber",
                url: "dovomin/resume/persian/{userid}",
                defaults: new { controller = "Authorized", action = "GetResume", english = false, userid = UrlParameter.Optional }
            );
            #endregion

            #region For Account Controller
            routes.MapRoute(
                name: "Login",
                url: "login",
                defaults: new { controller = "Account", action = "Login" }
            );
            routes.MapRoute(
                name: "Logout",
                url: "logout",
                defaults: new { controller = "Account", action = "Logout" }
            );
            routes.MapRoute(
                name: "ConfirmEmail",
                url: "new-account/{code}",
                defaults: new { controller = "Account", action = "ConfirmEmail" }
            );
            routes.MapRoute(
                name: "Signup",
                url: "new-account",
                defaults: new { controller = "Account", action = "Signup" }
            );            
            routes.MapRoute(
                name: "UsernameValidator",
                url: "check-username",
                defaults: new { controller = "Account", action = "CheckUsername" }
            );
            routes.MapRoute(
                name: "ProfileEditor",
                url: "my-profile",
                defaults: new { controller = "Account", action = "MyProfile" }
            );
            routes.MapRoute(
                name: "DovominProfile",
                url: "dovomin/id-{userId}",
                defaults: new { controller = "Account", action = "Dovomin" }
            );
            routes.MapRoute(
                name: "ForgotPassword",
                url: "forgot-password",
                defaults: new { controller = "Account", action = "Forgot" }
            );
            routes.MapRoute(
                name: "ResetPassword",
                url: "reset-password/{code}",
                defaults: new { controller = "Account", action = "ResetPassword" }
            );
            routes.MapRoute(
                name: "ChangePassword",
                url: "change-password",
                defaults: new { controller = "Account", action = "ChangePassword" }
            );
            #endregion

            #region For Jobs
            routes.MapRoute(
                name: "NewJob",
                url: "jobs/new-job",
                defaults: new { controller = "Job", action = "NewJob" }
            );

            routes.MapRoute(
                name: "EditJob",
                url: "jobs/edit-job/{id}",
                defaults: new { controller = "Job", action = "Edit" }
            );

            routes.MapRoute(
                name: "JobApply",
                url: "jobs/apply/{jobId}",
                defaults: new { controller = "Job", action = "Apply" }
            );

            routes.MapRoute(
                name: "RecentJobs",
                url: "jobs",
                defaults: new { controller = "Job", action = "RecentJobs" }
            );

            routes.MapRoute(
                name: "SingleJob",
                url: "jobs/{jobId}",
                defaults: new { controller = "Job", action = "SingleJob" }
            );
            #endregion

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
