export const name = "SchoolMessenger"; export const url = "https://status.powerschool.com/"; // SchoolMessenger was acquired by PowerSchool and lives on their status page // as a group of components. We filter specifically for those rather than // duplicating the overall PowerSchool check. const COMPONENTS_URL = "https://status.powerschool.com/api/v2/components.json"; // Atlassian component status → dashboard status const STATUS_MAP = { operational: "operational", under_maintenance: "degraded", degraded_performance: "degraded", partial_outage: "degraded", major_outage: "outage", }; const SEVERITY_ORDER = ["operational", "degraded", "outage"]; function worstStatus(a, b) { return SEVERITY_ORDER.indexOf(a) >= SEVERITY_ORDER.indexOf(b) ? a : b; } export async function checkStatus() { const res = await fetch(COMPONENTS_URL); if (!res.ok) { throw new Error(`SchoolMessenger status request failed (${res.status})`); } const data = await res.json(); const components = (data.components ?? []).filter((c) => c.name.startsWith("SchoolMessenger") ); if (components.length === 0) { throw new Error("No SchoolMessenger components found on status page"); } let overall = "operational"; const issues = []; for (const c of components) { const mapped = STATUS_MAP[c.status] ?? "unknown"; overall = worstStatus(overall, mapped); if (mapped !== "operational") { issues.push(`${c.name}: ${c.status.replace(/_/g, " ")}`); } } const message = issues.length > 0 ? issues.join(" | ") : "All services operational."; return { name, status: overall, message, lastUpdated: new Date().toISOString(), }; }