class PushNotificationUtil {
    static applyDefaults(notification) {
        return Object.assign({ icon: PushNotificationUtil.DEFAULT_ICON, badge: PushNotificationUtil.DEFAULT_BADGE }, notification);
    }
    static createIncidentCreatedNotification(params) {
        const { incidentTitle, projectName, incidentViewLink, incidentNumber, incidentNumberWithPrefix, incidentId, projectId, } = params;
        const displayNumber = incidentNumberWithPrefix || (incidentNumber ? `#${incidentNumber}` : "");
        const incidentIdentifier = displayNumber
            ? `${displayNumber} (${incidentTitle})`
            : incidentTitle;
        return PushNotificationUtil.applyDefaults({
            title: `New Incident${displayNumber ? ` ${displayNumber}` : ""}: ${incidentTitle}`,
            body: `A new incident has been created: ${incidentIdentifier} in ${projectName}. Click to view details.`,
            clickAction: incidentViewLink,
            url: incidentViewLink,
            tag: "incident-created",
            requireInteraction: true,
            data: {
                type: "incident-created",
                entityType: "incident",
                entityId: incidentId,
                projectId: projectId,
                incidentTitle: incidentTitle,
                projectName: projectName,
                url: incidentViewLink,
            },
        });
    }
    static createIncidentStateChangedNotification(params) {
        const { incidentTitle, projectName, newState, previousState, incidentViewLink, incidentNumber, incidentNumberWithPrefix, incidentId, projectId, } = params;
        const displayNumber = incidentNumberWithPrefix || (incidentNumber ? `#${incidentNumber}` : "");
        const incidentIdentifier = displayNumber
            ? `${displayNumber} (${incidentTitle})`
            : incidentTitle;
        const stateChangeText = previousState
            ? `Incident ${incidentIdentifier} state changed from ${previousState} to ${newState}`
            : `Incident ${incidentIdentifier} state changed to ${newState}`;
        return PushNotificationUtil.applyDefaults({
            title: `Incident${displayNumber ? ` ${displayNumber}` : ""} Updated: ${incidentTitle}`,
            body: `${stateChangeText} in ${projectName}. Click to view details.`,
            clickAction: incidentViewLink,
            url: incidentViewLink,
            tag: "incident-state-changed",
            requireInteraction: true,
            data: {
                type: "incident-state-changed",
                entityType: "incident",
                entityId: incidentId,
                projectId: projectId,
                incidentTitle: incidentTitle,
                projectName: projectName,
                newState: newState,
                previousState: previousState,
                url: incidentViewLink,
            },
        });
    }
    static createIncidentNotePostedNotification(params) {
        const { incidentTitle, projectName, isPrivateNote, incidentViewLink, incidentNumber, incidentNumberWithPrefix, incidentId, projectId, } = params;
        const noteType = isPrivateNote ? "Private" : "Public";
        const displayNumber = incidentNumberWithPrefix || (incidentNumber ? `#${incidentNumber}` : "");
        const incidentIdentifier = displayNumber
            ? `${displayNumber} (${incidentTitle})`
            : incidentTitle;
        return PushNotificationUtil.applyDefaults({
            title: `${noteType} Note Added: Incident${displayNumber ? ` ${displayNumber}` : ""} - ${incidentTitle}`,
            body: `A ${noteType.toLowerCase()} note has been posted on incident ${incidentIdentifier} in ${projectName}. Click to view details.`,
            clickAction: incidentViewLink,
            url: incidentViewLink,
            tag: "incident-note-posted",
            requireInteraction: true,
            data: {
                type: "incident-note-posted",
                entityType: "incident",
                entityId: incidentId,
                projectId: projectId,
                incidentTitle: incidentTitle,
                projectName: projectName,
                isPrivateNote: isPrivateNote,
                url: incidentViewLink,
            },
        });
    }
    static createAlertCreatedNotification(params) {
        const { alertTitle, projectName, alertViewLink, alertNumber, alertNumberWithPrefix, alertId, projectId, } = params;
        const displayNumber = alertNumberWithPrefix || (alertNumber ? `#${alertNumber}` : "");
        const alertIdentifier = displayNumber
            ? `${displayNumber} (${alertTitle})`
            : alertTitle;
        return PushNotificationUtil.applyDefaults({
            title: `New Alert${displayNumber ? ` ${displayNumber}` : ""}: ${alertTitle}`,
            body: `A new alert has been created: ${alertIdentifier} in ${projectName}. Click to view details.`,
            clickAction: alertViewLink,
            url: alertViewLink,
            tag: "alert-created",
            requireInteraction: true,
            data: {
                type: "alert-created",
                entityType: "alert",
                entityId: alertId,
                projectId: projectId,
                alertTitle: alertTitle,
                projectName: projectName,
                url: alertViewLink,
            },
        });
    }
    static createAlertEpisodeCreatedNotification(params) {
        const { alertEpisodeTitle, projectName, alertEpisodeViewLink, episodeNumber, episodeNumberWithPrefix, alertEpisodeId, projectId, } = params;
        const displayNumber = episodeNumberWithPrefix || (episodeNumber ? `#${episodeNumber}` : "");
        const episodeIdentifier = displayNumber
            ? `${displayNumber} (${alertEpisodeTitle})`
            : alertEpisodeTitle;
        return PushNotificationUtil.applyDefaults({
            title: `New Alert Episode${displayNumber ? ` ${displayNumber}` : ""}: ${alertEpisodeTitle}`,
            body: `A new alert episode has been created: ${episodeIdentifier} in ${projectName}. Click to view details.`,
            clickAction: alertEpisodeViewLink,
            url: alertEpisodeViewLink,
            tag: "alert-episode-created",
            requireInteraction: true,
            data: {
                type: "alert-episode-created",
                entityType: "alert-episode",
                entityId: alertEpisodeId,
                projectId: projectId,
                alertEpisodeTitle: alertEpisodeTitle,
                projectName: projectName,
                url: alertEpisodeViewLink,
            },
        });
    }
    static createIncidentEpisodeCreatedNotification(params) {
        const { incidentEpisodeTitle, projectName, incidentEpisodeViewLink, episodeNumber, episodeNumberWithPrefix, incidentEpisodeId, projectId, } = params;
        const displayNumber = episodeNumberWithPrefix || (episodeNumber ? `#${episodeNumber}` : "");
        const episodeIdentifier = displayNumber
            ? `${displayNumber} (${incidentEpisodeTitle})`
            : incidentEpisodeTitle;
        return PushNotificationUtil.applyDefaults({
            title: `New Incident Episode${displayNumber ? ` ${displayNumber}` : ""}: ${incidentEpisodeTitle}`,
            body: `A new incident episode has been created: ${episodeIdentifier} in ${projectName}. Click to view details.`,
            clickAction: incidentEpisodeViewLink,
            url: incidentEpisodeViewLink,
            tag: "incident-episode-created",
            requireInteraction: true,
            data: {
                type: "incident-episode-created",
                entityType: "incident-episode",
                entityId: incidentEpisodeId,
                projectId: projectId,
                incidentEpisodeTitle: incidentEpisodeTitle,
                projectName: projectName,
                url: incidentEpisodeViewLink,
            },
        });
    }
    static createMonitorStatusChangedNotification(params) {
        const { monitorName, projectName, newStatus, previousStatus, monitorViewLink, monitorId, projectId, } = params;
        const statusChangeText = previousStatus
            ? `Monitor status changed from ${previousStatus} to ${newStatus}`
            : `Monitor status changed to ${newStatus}`;
        return PushNotificationUtil.applyDefaults({
            title: `Monitor ${newStatus}: ${monitorName}`,
            body: `${statusChangeText} in ${projectName}. Click to view details.`,
            clickAction: monitorViewLink,
            url: monitorViewLink,
            tag: "monitor-status-changed",
            requireInteraction: true,
            data: {
                type: "monitor-status-changed",
                entityType: "monitor",
                entityId: monitorId,
                projectId: projectId,
                monitorName: monitorName,
                projectName: projectName,
                newStatus: newStatus,
                previousStatus: previousStatus,
                url: monitorViewLink,
            },
        });
    }
    static createScheduledMaintenanceNotification(params) {
        const { title, projectName, state, viewLink, scheduledMaintenanceNumber, scheduledMaintenanceNumberWithPrefix, scheduledMaintenanceId, projectId, } = params;
        const displayNumber = scheduledMaintenanceNumberWithPrefix ||
            (scheduledMaintenanceNumber ? `#${scheduledMaintenanceNumber}` : "");
        const maintenanceIdentifier = displayNumber
            ? `${displayNumber} (${title})`
            : title;
        return PushNotificationUtil.applyDefaults({
            title: `Scheduled Maintenance${displayNumber ? ` ${displayNumber}` : ""} ${state}: ${title}`,
            body: `Scheduled maintenance ${maintenanceIdentifier} ${state.toLowerCase()} in ${projectName}. Click to view details.`,
            clickAction: viewLink,
            url: viewLink,
            tag: "scheduled-maintenance",
            requireInteraction: false,
            data: {
                type: "scheduled-maintenance",
                entityType: "scheduled-maintenance",
                entityId: scheduledMaintenanceId,
                projectId: projectId,
                title: title,
                projectName: projectName,
                state: state,
                url: viewLink,
            },
        });
    }
    static createGenericNotification(params) {
        const { title, body, clickAction, tag, requireInteraction = false, } = params;
        const notification = {
            title: title,
            body: body,
            tag: tag || "OneUptime",
            requireInteraction: requireInteraction,
            data: {
                type: "generic",
            },
        };
        if (clickAction) {
            notification.clickAction = clickAction;
            notification.url = clickAction;
            notification.data["url"] = clickAction;
        }
        return PushNotificationUtil.applyDefaults(notification);
    }
    static createMonitorProbeStatusNotification(params) {
        const { title, body, tag, monitorId, monitorName } = params;
        return PushNotificationUtil.applyDefaults({
            title: title,
            body: body,
            tag: tag,
            requireInteraction: false,
            data: {
                type: "monitor-probe-status",
                monitorId: monitorId,
                monitorName: monitorName,
            },
        });
    }
    static createMonitorCreatedNotification(params) {
        const { monitorName, monitorId } = params;
        return PushNotificationUtil.applyDefaults({
            title: "OneUptime: New Monitor Created",
            body: `New monitor was created: ${monitorName}`,
            tag: "monitor-created",
            requireInteraction: false,
            data: {
                type: "monitor-created",
                monitorId: monitorId,
                monitorName: monitorName,
            },
        });
    }
    static createOnCallPolicyAddedNotification(params) {
        const { policyName } = params;
        return PushNotificationUtil.applyDefaults({
            title: "Added to On-Call Policy",
            body: `You have been added to the on-call duty policy ${policyName}.`,
            tag: "on-call-policy-added",
            requireInteraction: false,
            data: {
                type: "on-call-policy-added",
                policyName: policyName,
            },
        });
    }
    static createOnCallPolicyRemovedNotification(params) {
        const { policyName } = params;
        return PushNotificationUtil.applyDefaults({
            title: "Removed from On-Call Policy",
            body: `You have been removed from the on-call duty policy ${policyName}.`,
            tag: "on-call-policy-removed",
            requireInteraction: false,
            data: {
                type: "on-call-policy-removed",
                policyName: policyName,
            },
        });
    }
    static createProbeDisconnectedNotification(params) {
        const { probeName } = params;
        return PushNotificationUtil.applyDefaults({
            title: "OneUptime: Probe Disconnected",
            body: `Your probe ${probeName} is disconnected. It was last seen 5 minutes ago.`,
            tag: "probe-disconnected",
            requireInteraction: false,
            data: {
                type: "probe-disconnected",
                probeName: probeName,
            },
        });
    }
    static createProbeStatusChangedNotification(params) {
        const { probeName, projectName, connectionStatus, clickAction } = params;
        const notification = {
            title: `Probe ${connectionStatus}: ${probeName}`,
            body: `Probe ${probeName} is ${connectionStatus} in ${projectName}. Click to view details.`,
            tag: "probe-status-changed",
            requireInteraction: true,
            data: {
                type: "probe-status-changed",
                probeName: probeName,
                projectName: projectName,
                connectionStatus: connectionStatus,
            },
        };
        if (clickAction) {
            notification.clickAction = clickAction;
            notification.url = clickAction;
            notification.data["url"] = clickAction;
        }
        return PushNotificationUtil.applyDefaults(notification);
    }
    static createAIAgentStatusChangedNotification(params) {
        const { aiAgentName, projectName, connectionStatus, clickAction } = params;
        const notification = {
            title: `AI Agent ${connectionStatus}: ${aiAgentName}`,
            body: `AI Agent ${aiAgentName} is ${connectionStatus} in ${projectName}. Click to view details.`,
            tag: "ai-agent-status-changed",
            requireInteraction: true,
            data: {
                type: "ai-agent-status-changed",
                aiAgentName: aiAgentName,
                projectName: projectName,
                connectionStatus: connectionStatus,
            },
        };
        if (clickAction) {
            notification.clickAction = clickAction;
            notification.url = clickAction;
            notification.data["url"] = clickAction;
        }
        return PushNotificationUtil.applyDefaults(notification);
    }
}
PushNotificationUtil.DEFAULT_ICON = "/dashboard/assets/img/OneUptimePNG/1.png";
PushNotificationUtil.DEFAULT_BADGE = "/dashboard/assets/img/OneUptimePNG/6.png";
export default PushNotificationUtil;
//# sourceMappingURL=PushNotificationUtil.js.map