/** Token audience — which app may use the JWT. */
export const JWT_AUD = Object.freeze({
  MASTER: "master",
  SAT: "sat",
  RISK: "risk",
  SWI: "swi",
  PTW: "ptw",
});

/** Token purpose — lifecycle stage of the JWT. */
export const JWT_PURPOSE = Object.freeze({
  LOGIN: "login",
  APP_LAUNCH: "app-launch",
  APP_SESSION: "app-session",
});

/** Values accepted by POST /api/master/auth/app-launch `{ app }`. */
export const LAUNCH_APP_IDS = Object.freeze([
  JWT_AUD.SAT,
  JWT_AUD.RISK,
  JWT_AUD.SWI,
  JWT_AUD.PTW,
]);

export function isLaunchAppId(app) {
  return LAUNCH_APP_IDS.includes(String(app || "").trim().toLowerCase());
}
